thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Application & OT Security · Advanced

JWT Algorithm Confusion

A JWT flaw where an attacker switches the token's algorithm (for example RS256 to HS256) so the server verifies it with the wrong key type.

Definition

If a server uses the token header to choose verification and treats an RSA public key as an HMAC secret, attackers can sign tokens with the public key. Mitigation: fix the accepted algorithm and key per issuer, and use libraries that separate key types.

Example

A token re-signed with HS256 using the server's published RSA public key is accepted.

Exam tip

Never let the token decide its own verification algorithm.

Related terms