Verify JWT algorithm
When verifying JSON Web Tokens (JWTs), always specify the expected algorithm to prevent attackers from manipulating the alg attribute in the token header. Use a library that allows you to pass an explicit algorithm to verify(), such as jwt.verify(secret, token, 'HS256'). This prevents attacks like 'none' algorithm and algorithm confusion, where an attacker can bypass signature verification or use a public key as an HMAC key. Confirm that your library enforces the expected algorithm and treats unsigned or incorrectly signed tokens as invalid.
Follow #authentication or #jwt for new tips like this one, on your notifications page and, if you choose, in a daily or weekly email.
Comments
No comments yet.