Interview Prep/DevSecOps/Foundations, Threat Modeling and OWASP

What are the common JWT pitfalls?

AdvancedConceptFoundations, Threat Modeling and OWASP
Answer
  • Accepting alg: none or letting the token choose the algorithm; pin the expected algorithm server-side.
  • Not validating iss, aud, exp and nbf.
  • HS256 with a weak or shared secret; prefer asymmetric RS256/ES256 with JWKS for multi-service setups.
  • Storing tokens in localStorage where XSS can read them.
  • Long-lived tokens with no revocation; use short expiry plus refresh tokens with rotation.
  • Putting sensitive data in the payload: it is only base64url-encoded, not encrypted.
All DevSecOps questions Roadmap: Security in the pipeline

More on Foundations, Threat Modeling and OWASP