Reading view
OAuth 2.0 BCP Β§4.14 reuse detection in practice β race vs theft disambiguation
Standard advice for refresh tokens: rotate on every use, store hashed, set a short expiry. Done, right?
Not quite.
Rotation alone does nothing against token theft. If malware or XSS lifts a refresh token from a legit client, the attacker and the client race to rotate it next. Whoever loses the race gets a "token revoked" error β and the winner keeps the session.
From the serverβs point of view, it just sees two valid requests seconds apart. No alarm, no signal, nothing.
The missing piece is what OAuth 2.0 Security BCP Β§4.14 calls refresh token reuse detection: if a token that was already rotated is presented again, treat it as evidence of compromise and invalidate the entire session.
The core idea
Every token belongs to a family (FamilyId), shared across all rotations of a single login.
If a rotated token shows up again (outside a small grace window), you revoke the entire family:
- the attacker is locked out
- the legit user is forced to re-authenticate
- the session is no longer silently compromised
β
if (stored.ReplacedByTokenHash is not null && stored.RevokedAtUtc.HasValue) { var withinGrace = stored.RevokedAtUtc.Value.AddSeconds(graceSeconds) > DateTime.UtcNow; if (withinGrace) return Fail("token_recently_rotated"); // benign race (SPA tabs, retries) await RevokeFamilyAsync(stored.FamilyId, ip, reason: "reuse_detected"); return Fail("token_reuse_detected"); } Client-side itβs just one extra branch:
if (error.code === "token_reuse_detected") { // "You've been signed out for security reasons. Please log in again." router.push("/login?reason=compromised"); } You can also hook into it for observability (alerts, SIEM, etc.):
services.AddSingleton<IAuthEventSink, SlackAlertSink>(); The tricky parts
- Race vs theft look identical. Two requests with the same token arrive. One is legit, one might not be. Only timing differs. Grace window too small β false positives on flaky networks. Too large β real attack window. ~30 seconds worked well in practice.
- Revoking the whole chain. On reuse you must invalidate all still-active tokens from that session. A simple
FamilyId+ index makes this a single bulk update. - Concurrency is common. Multi-tab SPAs, retries, mobile reconnects β without a grace window, I was logging myself out constantly during tests.
I ended up adding this to a small self-hosted auth library Iβve been working on (https://www.reddit.com/r/dotnet/comments/1shpady/selfhosted\_auth\_lib\_for\_net/)
[link] [comments]
Bitwarden CLI Compromised in Ongoing Checkmarx Supply Chain Campaign
ThreatsDay Bulletin: $290M DeFi Hack, macOS LotL Abuse, ProxySmart SIM Farms +25 New Stories
[Webinar] Mythos Reality Check: Beating Automated Exploitation at AI Speed
Project Glasswing Proved AI Can Find the Bugs. Who's Going to Fix Them?
China-Linked GopherWhisper Infects 12 Mongolian Government Systems with Go Backdoors
Vercel Finds More Compromised Accounts in Context.ai-Linked Breach
Apple Fixes iOS Flaw That Let FBI Recover Deleted Signal Messages
Pack2TheRoot (CVE-2026-41651): Cross-Distro Local Privilege Escalation Vulnerability
Some more information from the author of PackageKit on https://www.openwall.com/lists/oss-security/2026/04/22/6 too.
Expect to see reliable (public) exploits pretty soon.
[link] [comments]
Malicious KICS Docker Images and VS Code Extensions Hit Checkmarx Supply Chain
Self-Propagating Supply Chain Worm Hijacks npm Packages to Steal Developer Tokens
AI Tools Are Helping Mediocre North Korean Hackers Steal Millions
Harvester Deploys Linux GoGra Backdoor in South Asia Using Microsoft Graph API
Lotus Wiper Malware Targets Venezuelan Energy Systems in Destructive Attack
Toxic Combinations: When Cross-App Permissions Stack into Risk