Uncovering Race Conditions in Endpoint API Key Generation
An endpoint that lets users create developer API keys enforced a maximum of ten keys and unique key names, but the server did not properly validate requests sent at the same time. An attacker could send many identical requests in parallel and have more keys created than the limit allowed, bypassing the uniqueness rule.
Published on anjarwilujeng.medium.com
I would like to share my experience in finding a race condition bug on a bug bounty program platform without mentioning name of the application or program specific details. This is meant to be my personal note, but I also want to share it with the community where I have also been helped a lot by other people’s…
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 server checked the key count and name uniqueness without locking or atomic handling, so concurrent requests all passed validation before any of them was saved.
Impact
An attacker could create more API keys than the intended limit and reuse names that should have been rejected, potentially exceeding the account's allowed number of credentials.
What the attacker needed
An account able to create API keys; ability to send requests in parallel
How it was found
- Identify the API key creation feature and its limits: a maximum of ten keys and unique names.
- Record the key creation request in Burp Suite to learn the endpoint and parameters.
- Duplicate the request into several Repeater tabs with identical parameters.
- Send all the requests in parallel using the Repeater Group feature.
- Observe that most responses reported success despite the uniqueness rule.
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 happens when a program checks something and then acts on it, but two requests arrive so close together that both pass the check before either one is recorded. Here the site checked how many keys you had and whether the name was already used, but sending many requests at once let several of them slip past that check. The result is that rules meant to limit you can be broken by acting simultaneously rather than one at a time.
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.