Skip to content
Race condition Write-up Intermediate

**Time-of-check Time-of-use (TOCTOU) Race Condition Leads to Broken Authentication**

During periods when the login service was slow, several different wrong passwords all returned successful responses and valid session tokens. The password check and the token-issuing step were not synchronised, so concurrent requests could pass the check before state was updated.

Irsyad Muhammad Fawwaz Follow

Published on infosecwriteups.com

I was bored and started poking at random public bug bounty programs. As usual I began with subdomain hunting to narrow the attack surface.

Irsyad Muhammad Fawwaz, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the password check and token issuance formed a non-atomic sequence with no per-account lock, so concurrent requests could pass the check before state was updated.

Impact

An attacker could obtain valid session tokens for accounts without knowing the correct password, though only while the server was slow enough to open the race window.

What the attacker needed

A login or register page; server slow enough to open a race window; ability to send many concurrent requests

The fix

The login check and token issuance should be made atomic, for example with a per-account lock or a database transaction that locks the row.

How it was found

  1. Find a login or register page on a subdomain.
  2. Notice that the site is very slow at certain times of day.
  3. Run login brute force tests during both fast and slow periods.
  4. Observe that during slow windows several wrong passwords return success and tokens.
  5. Validate the returned tokens against protected endpoints.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A race condition is when two parts of a program run at the same time and get out of step. Here the part that checks a password and the part that hands out a login token were not locked together, so when the server was slow, requests could slip through the check before it finished. The result was that wrong passwords could still produce working login tokens.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.