Interview practice question
JWT algorithm confusion
Backend Engineering · Auth and Security · Experienced
An attacker forged valid admin JWTs against your service, which uses RS256. Your library accepted a token signed with HS256 using your public key. Explain and fix.
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Algorithm confusion attack.
- Library trusted alg header.
- Public key used as HMAC secret.
- Pin expected algorithm per key.
- Upgrade library, rotate keys, revoke tokens.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.