Offensive Jwt
This skill systematically tests JSON Web Tokens for common security vulnerabilities by checking for algorithm confusion attacks, weak secrets, and unsafe header parameter handling. It provides a structured checklist to guide developers through each attack vector and tracks completion status across targets.
How to Install
git clone --depth 1 https://github.com/SnailSploit/Claude-Red.git && cp Claude-Red/Skills/auth/offensive-jwt ~/.claude/skills/SKILL.md -rOverview
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
RSAandHMAC(confusion attack) - Weak or guessable HMAC secret (brute-forceable)
kid,jku,jwk,x5uheader 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
- Check
Authorization: Bearer <token>headers in all requests - Look for cookies containing JWT structures (
eyJ...) - Examine browser local/session storage
- Decode the token at jwt.io or via BurpSuite JWT extension — inspect claims and header parameters
- Note any
kid,jku,jwk,x5ufields 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
algisnoneor a case variant (None,NONE,nOnE) - Algorithm Confusion (RS256→HS256) — Server uses RSA public key as HMAC secret when attacker switches
algto HS256; attacker re-signs token with the public key - Key ID (
kid) Manipulation — Exploitingkidto 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,issnot 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
jwkheader - 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
kidcollisions or response header manipulation critHeader 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 kSecAttrAccessible — kSecAttrAccessibleAlways is insecure
- iTunes/iCloud backup extraction: unencrypted backups expose Keychain
- Jailbreak + Keychain-Dumper for full extraction
- Tools: Frida, objection, idb
React Native / Hybrid:
- AsyncStorage stored in plain text (Android SQLite DB, iOS plist); no encryption by default
```bash
Android — check SharedPreferences
adb shell "run-as com.target.app cat /data/data/com.target.app/shared_prefs/auth.xml"
iOS — extract from backup
ideviceback
Details
| Category | AI/ML → ml |
| Source | SnailSploit/Claude-Red |
| SKILL.md | View on GitHub → |
| Repo Stars | ★ 2.4K |
| Est. per Skill | N/A (shared across 50 skills from this repo) |
| Difficulty | Intermediate |
| Risk Level | N/A |
Related Skills
Works Well With
Skills from the same repository — often designed to work together