Skip to content

JWT Token Lifetime

SeverityMedium to High
Checksjwt.missing_expiry, jwt.long_lifetime, jwt.expired_accepted
ClassificationsCWE-613: Insufficient Session Expiration
OWASP CategoryOWASP API2:2023 Broken Authentication

The exp claim bounds how long a leaked or stolen token stays usable. A token without exp, with a lifetime of days or months, or accepted after exp has passed, gives an attacker a long window to replay it.

CheckModeWhat it detects
jwt.missing_expiryOfflineThe token has no exp claim
jwt.long_lifetimeOfflineexp minus iat (or minus now without iat) is above --max-token-lifetime (default 24h)
jwt.expired_acceptedOnlineThe server accepts the token while its exp is in the past

jwt.expired_accepted sends the token as given, so pass an expired token. When the HMAC secret is known, timestamp tampering re-signs a valid token with an expired exp.

Terminal window
jwtop crack [token] --max-token-lifetime 1h
jwtop crack [expired-token] --url [url]

A token that never expires, or whose expiry is not enforced, can be replayed indefinitely once leaked through logs, browser storage or a compromised client.

  • Always set exp, and keep access token lifetimes short (minutes to hours); use refresh tokens for longer sessions.
  • Verify exp on every request and do not disable claims validation in the JWT library.