Algorithm confusion attacks
Summary: Algorithm confusion attacks, also called key confusion attacks, occur when an attacker forces a server to verify a JWT signature using a different algorithm than the developers intended, potentially letting them forge valid tokens with arbitrary values without knowing the secret signing key. The flaw typically stems from JWT libraries that offer a single algorithm-agnostic verify() method relying on the token's alg header, so a server expecting RS256 may treat its public key as an HMAC secret when it receives an HS256 token.
Key Takeaway: A public key that is meant to be shared can become the signing secret for a forged token, and the attack only requires the key to match the server's local copy byte for byte, including non-printing characters. Servers that expose keys at /jwks.json or /.well-known/jwks.json, or that leak them through pairs of existing JWTs, hand attackers the material needed to mint tokens the server will accept.
Read the original at PortSwigger Research ↗
- Topics
- Vulnerabilities & Patching
- Related
- Attackers Exploit UnrealIRCd Flaw That Enables Server-Level Command Injection Cyber Risks · Nov 14, 2026U.S. CISA adds Check Point and UnrealIRCd flaws to its Known Exploited Vulnerabilities catalog Cyber Risks · Nov 14, 2026PostgreSQL Patches 52 Flaws, Including 22-Year-Old Bug Enabling Authenticated RCE Cyber Risks · Nov 13, 2026