explaingit

ewreaslan/jwttx

9PythonAudience · developerComplexity · 3/5ActiveSetup · easy

TLDR

Python CLI for JWT security assessment: parses tokens, runs algorithm confusion and alg:none attacks, brute-forces HMAC secrets, forges claims, and crafts kid/jku/jwk payloads.

Mindmap

mindmap
  root((jwttx))
    Inputs
      JWT strings
      Wordlists
      RSA keys
    Outputs
      Decoded claims
      Forged tokens
      Attack payloads
    Use Cases
      Pentest auth flows
      Crack HMAC secrets
      Reproduce CVEs
    Tech Stack
      Python
      CLI
      JWT

Things people build with this

USE CASE 1

Audit JWT auth on a web app in a sanctioned pentest

USE CASE 2

Crack weak HMAC secrets from captured tokens with a wordlist

USE CASE 3

Reproduce alg:none and RS256 to HS256 confusion bugs in a lab

USE CASE 4

Forge admin role tokens once a signing secret is recovered

Tech stack

PythonCLIJWT

Getting it running

Difficulty · easy Time to first run · 30min

Needs Python 3.10+ and a pip editable install; only useful if you already have target JWTs and authorization to test.

In plain English

This project is a command line toolkit built around JSON Web Tokens, which are the small encoded strings websites and APIs use to prove who you are after you log in. The toolkit is aimed at security engineers and testers who need to look at these tokens, find weaknesses in how they are signed, and reproduce known attacks in controlled environments such as labs or authorised audits. The toolkit groups its work into a set of commands. The parse command decodes the header and payload of a token and annotates what it finds. The summary command produces a prioritised report of the attack surface and suggests next steps. Other commands generate specific attack payloads: none creates variants that drop the signature algorithm, confusion builds tokens that try to trick a server expecting RS256 into accepting HS256, kid and jku-spoof craft headers that point to attacker-controlled keys, and jwk-inject embeds a fresh public key in the header and signs the token with the matching private key. There are also offensive helpers for cracking and forging. The brute command runs a dictionary attack against tokens signed with HMAC, trying every entry in a wordlist as the secret. The forge command re-signs a token with new claims, for example switching a role to admin, once a secret or key is known. Verify checks whether a candidate secret matches a token signature. Installation needs Python 3.10 or newer. After running pip install on the project folder, you call jwt-toolkit with one of the commands. Helpers like gen-keys and gen-jwks create RSA keypairs and JWKS files for setting up test scenarios. The README closes with a responsible use statement: the tools are for authorised testing, research, and training only, not for use against systems without permission.

Copy-paste prompts

Prompt 1
Show me the jwt-toolkit commands to test a captured JWT for alg:none and RS256 HS256 confusion
Prompt 2
Walk me through using jwt-toolkit brute with a wordlist to recover an HMAC secret
Prompt 3
How do I use jwt-toolkit forge to change the role claim after recovering the secret
Prompt 4
Generate RSA keys and a JWKS file with jwt-toolkit for a kid injection test
Prompt 5
Explain the jku-spoof and jwk-inject commands and when to pick one over the other
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.