JWT Key Confusion Attack
JWT key confusion is a token verification weakness involving a mismatch between the type of signing key a service expects and the key type it accepts.
Why the Two Names
The attack can be described from either angle: the attacker confuses the library about the _algorithm_ (asymmetric to symmetric), which in turn causes it to confuse how the _key_ is used (a verification public key treated as a signing secret). Both descriptions name the same flaw.
Not the Same As
Key Confusion is sometimes loosely stretched to cover any attack on how a library selects a verification key. Those are distinct, separately named issues rather than part of this attack:
- JWT Kid Injection: injection or path traversal via the
kidheader to point verification at an attacker-known key. - JKU/X5U abuse: getting the server to fetch a JWKS or certificate from an attacker-controlled URL.