Home / Knowledge hub / Token replay
Knowledge hub
Token replay
Reusing a stolen or captured token to be accepted as its rightful owner.
What it means
Token replay is when an attacker takes a valid token, such as a session value or an access token, and presents it themselves. The server sees a token it issued, still in date, and treats the sender as the person it was issued to.
Most tokens are bearer tokens. The OAuth specification says that anyone who holds one can use it, with no proof of who they are. That is why the reuse works, and why where the token has been, and how long it lives, matter more than how it was made.
Why it matters
A replayed token passes every check, including multi-factor sign-in the user completed earlier. Nothing in the log looks odd except perhaps a new device or location. The attacker reads data and makes changes under a real identity, until the token expires or someone revokes it.
The business impact is therefore tied to token life. Long-lived tokens turn a brief leak, for example in a support ticket or an error report, into extended access. The replay attack family is wider, but this version is behind many cases of session hijacking.
How it shows up
Tokens leak through logs, URLs, browser history, analytics tools, error messages, malware, XSS, and a proxy or tool that records traffic. They are then replayed from another machine. Defences are short expiry, careful storage, revocation, and binding to the holder.
Sender-constrained tokens do the last part. DPoP, defined in RFC 9449, ties a token to a key held by the client, so a copy without the key is refused. Mutual TLS can do the same. The mistakes: tokens in query strings, long lifetimes, no revocation, and logs that store the Authorization header. Check each.
Questions people ask
Token replay, answered
How do attackers get tokens to replay?
Most often from places the team did not think of: application logs, URLs, support screenshots, third-party scripts, error trackers, and cross-site scripting. Some come from malware on a user's device.
Wherever the token is stored or logged is a possible source.
Does HTTPS stop token replay?
It stops capture on the network, which is important, but not capture from a device, a log or a script on the page. Once the token is out, HTTPS does not stop it being sent again.
Other controls are needed for that.
What is a sender-constrained token?
It is a token tied to something only the rightful client holds, usually a cryptographic key. The client has to prove it holds the key on each request. DPoP and mutual TLS are two ways of doing this.
A stolen copy then fails.
Is token replay the same as session hijacking?
Session hijacking is the same idea applied to a session identifier. Token replay is the wider term, covering session cookies, API tokens, JWTs and refresh tokens as well.
See session hijacking.
How is token replay tested?
Copy a token from one client, use it from another machine, and then use it after logout, after a password change and after the expiry time. Check whether the app notices anything.
If it works, the finding shows exactly how.
Related
Terms that sit next to this one
Replay attack
Capturing a valid request and sending it again to get the same result twice.
Bearer token
A token that works for whoever holds it, with no further proof of identity.
Device binding
Tying a session or token to one device so a copy elsewhere is refused.
Token revocation
Cancelling a token before it expires, for example after a password change.
Session hijacking
Stealing the token that tells your application a browser is logged in.
What can a copied token still do?
We test whether tokens your app issues can be reused from another machine, after logout or after they should have expired, and every finding comes with the request that proved it. Book a pilot on one app.
Or start with a $199 pilot on one application: thirty days, success criteria agreed before day one, credited against the annual if you convert.