
Cloud Vulnerability DB
A community-led vulnerabilities database
Logto's one-time token verification contains a TOCTOU race condition. The verifyOneTimeToken() function reads a token's status as Active, validates it, then issues an UPDATE query that has no WHERE status = Active predicate. Under PostgreSQL Read Committed isolation, two concurrent transactions can both read Active, both pass validation, and both update the row to Consumed - each returning success to the caller.
A one-time password-reset token or magic-link token that should be single-use can be consumed by two concurrent flows:
packages/core/src/queries/one-time-tokens.ts has an updateOneTimeTokenStatus function that issues: UPDATE one_time_tokens SET status = Consumed WHERE token = $token RETURNING * There is no AND status = Active predicate. Both concurrent writers succeed. packages/core/src/libraries/one-time-token.ts#verifyOneTimeToken() performs a read-then-write: checkOneTimeToken() reads and validates the token is Active, then updateOneTimeTokenStatus() updates to Consumed without checking current status. Under PostgreSQL Read Committed:
PostgreSQL-backed concurrency test: 30/30 race iterations both transactions successfully verified the same Active token (100% reproduction).
Add AND status = Active to the UPDATE WHERE clause: UPDATE one_time_tokens SET status = Consumed WHERE token = $token AND status = Active RETURNING *
Anonymous researcher
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."