A JWT is signed with RS256, and the server publishes its public key at /jwks.json. The tester needs a token carrying an admin role claim. Which approach BEST achieves this?
Show the answer
Correct answerD. Switch alg to HS256 and sign with the published public key
AWhy not this: RS256 uses an asymmetric key pair, so there is no shared secret for a wordlist to recover.
BWhy not this: Replaying the token only reuses the existing user's role and does not create an admin claim.
CWhy not this: Altering the payload invalidates the original signature, so a correct verifier rejects the token.
DWhy this is right: The server may verify an HS256 token using the public key as the HMAC secret, which the tester can also use to sign.
If the server trusts the alg header, switching to HS256 makes it verify the signature as an HMAC using the public key as the secret, which the tester knows, so a forged admin token validates. Editing the claim without re-signing fails because the original signature no longer matches.