JWT

Informational

JSON Web Token

Definition

JSON Web Token (JWT) is an open standard (RFC 7519) for creating access tokens that contain claims encoded in JSON. A JWT has three parts: header (algorithm), payload (claims) and signature. They are widely used for API authentication. JWT vulnerabilities can lead to authentication bypass and privilege escalation.

Impact

Stateless authentication widely used in modern APIs'none' algorithm attacks can allow creating unsigned tokensAlgorithm confusion (RS256 to HS256) can allow forging tokensWeak secrets can be brute-forced (jwt_tool, hashcat)Tokens without expiration or with modifiable claims enable account takeover

Examples

JWT structure and common attacks

The most common JWT attacks include: changing the algorithm to 'none' to avoid signature verification, cracking weak secrets with hashcat, or exploiting the confusion between symmetric (HS256) and asymmetric (RS256) algorithms to forge valid tokens.

# JWT structure (3 parts separated by dots):
# HEADER.PAYLOAD.SIGNATURE

# Header (base64url)
{"alg": "HS256", "typ": "JWT"}

# Payload (base64url)
{"userId": "123", "role": "user", "exp": 1713262800}

# Attack 1: Algorithm None
# Change the header to {"alg": "none"} and remove the signature
# eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJ1c2VySWQiOiIxMjMiLCJyb2xlIjoiYWRtaW4ifQ.

# Attack 2: Crack a weak secret
$ hashcat -a 0 -m 16500 jwt.txt rockyou.txt
# If the secret is "password123", you can now sign arbitrary tokens

Practice JWT with real labs

Apply what you've learned in safe environments based on real bug bounty reports.

See practice labs
2,482

hunters training

62

labs from real hacks

1,630

completions

$14,790

paid out for these bugs

11 flags captured this week·Real hacks from HackerOne · YesWeHack · Bugcrowd·No commitment·Free Academy
Free · no account

The checklist I run on every new target

47 checks ordered by cost: first what can get you in trouble, then the cheap stuff, and finally the expensive stuff — which is where the big bounties are. I'll send it to your inbox right now.

Unsubscribe in one click, from any email.

BBLabs · bug bounty training

Stop reading about bugs and start hunting them

Create your free account and practice on labs based on real hacks that paid out thousands of euros. The Academy is free forever.

No card · free Academy · cancel anytime