Solo Dev's Anti-Theft Token Logic Locked Out All Users Due to Replay Edge Cases
A solo developer building a finance app discovered that its OWASP-recommended refresh token reuse detection was incorrectly flagging legitimate same-device token replays as theft attempts, locking out all users. The flaw stemmed from three benign scenarios: dropped network connections causing clients to retry already-rotated tokens, failed keychain writes leaving apps with stale tokens, and race conditions between the main app and its widget extension both refreshing simultaneously. Because the security logic treated any revoked-token replay as theft and revoked all sessions, real users were repeatedly signed out despite no actual attack occurring. The developer's fix introduced device ID binding to distinguish same-device replays from genuinely suspicious cross-device reuse, reserving the full session wipe only for the latter. Supporting changes included a cross-process refresh mutex, hardened keychain write handling, and ensuring transient network failures never result in forced logouts.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in