Race Condition → Organization Takeover by Removing All Owners
An organisation was supposed to always keep at least one Owner, but the check was not safe against concurrent requests. An Admin could send two Owner-removal requests at the same time, delete both Owners, and leave the organisation with no Owner and no way to restore one.
medium.com
Published on medium.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 'at least one Owner must remain' check and the deletion were not performed atomically, so concurrent requests each saw a valid state before either deletion was committed.
Impact
An Admin could remove every Owner and gain uncontested control of the organisation, and ownership could not be restored afterwards.
What the attacker needed
An Admin account in the organisation; at least two existing Owners; ability to send concurrent requests
The fix
The application should validate Owner removal atomically so that deletion is blocked whenever it would leave zero Owners, even under concurrent execution, and should restrict Owner management to Owners.
How it was found
- Create an organisation with two Owners and one Admin.
- Log in as the Admin account.
- Intercept the deletion requests for both Owners with a proxy.
- Group the two requests together.
- Send both requests at the same time using a single-packet attack.
- Observe that both Owners are deleted and the organisation has zero Owners.
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.
An organisation has roles, and the system tries to make sure at least one person with the top role (Owner) always remains. A race condition means two actions happen at almost the same moment, so each one checks the rule before the other has finished, and both get through. Here an Admin fired two removal requests together, both passed the check, and the organisation ended up with nobody in charge.
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.