Race condition (TOCTOU) on OAuth2 authorization_code redemption: concurrent requests all succeed
Finding
An OAuth2 authorization_code is single-use by specification. Here, concurrent redemption of the same code returned 200 to every request in the batch instead of rejecting all but the first: the single-use check reads the code state before any of the winning requests commits, so all of them pass.
Reproduction
1. Obtain one valid authorization_code. 2. Fire N simultaneous POST /oauth/token requests with the same grant_type=authorization_code and the same code (last-byte synchronisation or a high-concurrency burst). 3. Measure: every request in the window returns 200; no 409, no 400, no "code already used".
The losing requests should be rejected; they are not. One code, many token pairs.
Reference
| Field | Value |
|---|---|
| Report | SALTOSYSTEMS-2RN028N1 |
| Program | Salto Home Solutions |
| Reported | 2026-10-07 |
| Severity | Medium |
| CVSS 3.0 | AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N |
Takeaway
State the attacker's first step before writing the report. If that first step is "already hold the victim's authorization code", the race is real but the threat model has to defend it — and that is a conversation to have with the triager, with the measurement table in hand, not an assumption to bury in the severity score.
Technically: single-use checks in token endpoints need an atomic compare-and-swap (or a unique index on the code), not a read-then-write.