How I Chained a Race Condition With Broken Access Control for Fu
A profile update endpoint accepted a client-supplied user_id and, when raced with a failing impersonation request, applied the update in the target user's context. An attacker could change another user's email and phone, trigger a password reset to their own address, and take over the account.
Published on meetcyber.net
Race conditions are often considered “logic bugs.” Broken access control is a classic vulnerability from OWASP Top 10. But what happens when you combine them?
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 backend trusted a client-supplied user_id in the profile update and used shared request state during impersonation, so a concurrent failing impersonation request left the target user's context active for the update.
Impact
An attacker could take over any user's account, including admin accounts, by changing the email and resetting the password; the text says this worked reliably across different accounts.
What the attacker needed
A regular user account; ability to send parallel requests; knowledge of the target user_id
The fix
The backend should enforce role checks on the API, make profile updates atomic, reject client-supplied user_id, and scope tokens per user.
How it was found
- Start as a regular user with no impersonation privileges.
- Send two parallel requests: one to switch-user for the target, which fails access control, and one to update-profile with a manually injected user_id for the target.
- The race causes the profile update to be processed in the target user's context before the impersonation request is denied.
- The attacker's email and phone are now set on the victim's account.
- Trigger the password reset flow, which sends the reset to the attacker's email.
- Reset the password and log in as the victim.
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 requests arrive so close together that the program handles them in an unexpected order. Broken access control means the server does not properly check whether you are allowed to do something. Here, sending a failing impersonation request and a profile update at the same time let the update run as if it were the other user, so the attacker could change their email and reset their password.
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.