Skip to content
Skillpedia
Security10k Β· #11947

offensive-jwt

What it does

This skill is a checklist for testing JWT-based authentication in authorized penetration tests. It covers algorithm confusion, weak secrets, header injection and key caching problems. It is for security professionals checking whether token login can be bypassed.

When to use it

  • βœ“When you are testing a web or mobile app's JWT login in an authorized penetration test.
  • βœ“When you want to check whether a server accepts unsigned or altered tokens.
  • βœ“When you need to review how a JWT's key ID or key URL headers are handled.

Skill link

https://github.com/SnailSploit/Claude-Red/blob/main/Skills/auth/offensive-jwt/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/SnailSploit/Claude-Red/blob/main/Skills/auth/offensive-jwt/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

β€œWe are authorized to test our login. Check the JWT tokens for weak signing or algorithm confusion.”

5 new skills a week. 1 minute to read.

How it works

The skill works through a checklist in order. It checks the algorithm, the signing secret, the key headers and key caching, and applies each technique to the target.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Overview

Comprehensive JWT attack checklist for offensive security engagements. Follow steps in order; apply each technique to the current target context and track which items have been completed.

Quick Reference: Misconfigurations to Check

  • Algorithm set to none β€” signature verification bypassed entirely
  • Algorithm switching between RSA and HMAC (confusion attack)
  • Weak or guessable HMAC secret (brute-forceable)
  • kid, jku, jwk, x5u header parameters accepted without validation
  • Expired or tampered tokens accepted by server
  • Sensitive data stored unencrypted in payload

Useful tool: JWT Tool

Mechanisms

JWTs (RFC 7519) consist of three Base64URL-encoded parts: header.payload.signature.

Signing algorithms:

Algorithm Type Notes
HS256/384/512 Symmetric HMAC Shared secret; confusion target
RS256/384/512 Asymmetric RSA Public key can be misused as HMAC secret
ES256/384/512 Asymmetric ECDSA
PS256/384/512 RSASSA-PSS
EdDSA (Ed25519/Ed448) Asymmetric
none Unsigned Critically insecure

Additional pitfalls:

  • JWS/JWE confusion: server accepts encrypted token (JWE) where signed (JWS) is expected, or fails open on unexpected typ/cty
  • JWKS retrieval: SSRF via jku/x5u, insecure TLS, poisoned key caching, kid collisions
  • Token binding (DPoP, mTLS): incorrectly implemented allows replay from other clients

Hunt: Identifying JWT Usage

  1. Check Authorization: Bearer <token> headers in all requests
  2. Look for cookies containing JWT structures (eyJ...)
  3. Examine browser local/session storage
  4. Decode the token at jwt.io or via BurpSuite JWT extension β€” inspect claims and header parameters
  5. Note any kid, jku, jwk, x5u fields in the header β€” these are attack surfaces

Vulnerability Map

JWT Vulnerabilities
β”œβ”€β”€ Algorithm Bypass
β”‚   β”œβ”€β”€ alg:none attack
β”‚   └── RS256β†’HS256 confusion (public key as HMAC secret)
β”œβ”€β”€ Weak Secret Key β†’ Brute force
β”œβ”€β”€ kid Parameter Injection
β”‚   β”œβ”€β”€ SQL injection via kid
β”‚   └── Path traversal via kid
β”œβ”€β”€ Header Injection
β”‚   β”œβ”€β”€ jwk (inline fake key)
β”‚   β”œβ”€β”€ jku/x5u (remote attacker-controlled JWKS)
β”‚   └── JWKS cache poisoning
└── Missing / Broken Validation
    β”œβ”€β”€ No signature check
    β”œβ”€β”€ Expired tokens accepted
    └── iss/aud/exp not validated

Vulnerabilities

Algorithm Vulnerabilities

  • alg:none β€” Some libraries disable signature validation when alg is none or a case variant (None, NONE, nOnE)
  • Algorithm Confusion (RS256β†’HS256) β€” Server uses RSA public key as HMAC secret when attacker switches alg to HS256; attacker re-signs token with the public key
  • Key ID (kid) Manipulation β€” Exploiting kid to load wrong keys or inject file paths / SQL; enforce strict lookups

Signature Vulnerabilities

  • Weak HMAC Secrets β€” Brute-forceable with dictionary or hashcat
  • Missing Signature Validation β€” Token accepted without any verification
  • Broken Validation β€” Implementation errors in signature checking logic

Implementation Issues

  • Missing Claims Validation β€” exp, nbf, aud, iss not verified
  • Insufficient Entropy β€” Predictable JWT IDs or tokens
  • No Expiration β€” Tokens valid indefinitely
  • Insecure Transport β€” Token sent over HTTP
  • Debug Leakage β€” Detailed error messages expose implementation

Header Injection Attacks

  • JWK Injection β€” Supply a custom attacker-controlled public key via the jwk header
  • JKU Manipulation β€” Point jku (JWK Set URL) to attacker-controlled JWKS endpoint
  • x5u Misuse β€” Load untrusted X.509 key URL; exploit lax TLS validation or open redirects
  • JWKS Cache Poisoning β€” Force caches to accept attacker keys via kid collisions or response header manipulation
  • crit Header Abuse β€” Server ignores unknown critical parameters, enabling bypass

Information Disclosure

  • Sensitive data (PII, credentials, session details) stored unencrypted in payload
  • Internal service/backend information leaked via claims

Additional Attack Vectors

Mobile App JWT Storage

Android:

  • SharedPreferences: Check if world-readable; location /data/data/<package>/shared_prefs/
  • Keystore extraction: root device or exploit app
  • Backup extraction: adb backup -f backup.ab <package> (if allowBackup=true)
  • Tools: Frida, objection, MobSF

iOS:

  • Keychain: Check `kSecAttrA
FAQ

What is algorithm confusion?

It is when a server is tricked into checking a token with the wrong algorithm, such as using a public key as a secret.

Which tool does it mention?

It mentions the JWT Tool project for testing tokens.

Is this for testing my own app?

It is written for authorized testing of an app, where you have permission to test it.

Details

Original description by the author

JWT attack methodology for penetration testers. Covers algorithm confusion (alg:none, RS256β†’HS256), weak HMAC secret brute force, kid parameter injection (SQLi, path traversal), jku/x5u/jwk header injection, JWKS cache poisoning, JWS/JWE confusion, timing attacks, and mobile JWT storage extraction. Use when testing JWT-based authentication, hunting auth bypass via token manipulation, or evaluating JWT implementation security in web or mobile apps.

repo: SnailSploit/Claude-Red

Popularity

GitHub stars
10k
Ranking position
#11947
License
MIT
Updated
10/12/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills