← All vulnerabilities

JWT Algorithm Confusion

Critical · Authentication · CWE-347

Description

Server accepts unexpected alg (none/HS/RS confusion).

Root cause

Custom JWT validation bugs.

Impact

Forged tokens, privilege escalation.

Detection

alg header tampering tests.

Mitigation

Allow-list algorithms; use vetted JWT libs.

Secure coding

Reject none; separate keys for HS vs RS.

Safe lab example

lab-jwt-alg

Practise related skills in Labs or deepen on Academy library.