Q24: What is a JWT Replay Attack and how do `jti` claims and nonces mitigate it?

Difficulty:MediumTopic:Security

A Replay Attack occurs when an attacker intercepts a valid signed JWT transmitted across a network and retransmits it multiple times to unauthorized API endpoints.

Mitigation Strategies:

  1. Short Expiration Times (exp): Reduces the time window during which intercepted tokens remain usable.
  2. Unique Token Identifiers (jti): Auth server includes a unique UUID inside the jti claim. API gateways record used jti tokens in a cache (e.g., Redis) and reject duplicated submissions.
  3. Client Nonces (nonce): Used in OIDC to bind the authorization request to the resulting ID token signature.
Key Takeaways
  • Replay attacks involve retransmitting intercepted valid tokens.

  • Use unique jti claims and short token expiration lifetimes to block token replay.