Bypassing API Key Limits Using a Race Condition
The API key creation endpoint enforced a limit of 10 keys only in the UI, not atomically on the backend. By sending many creation requests simultaneously, an attacker could create more keys than allowed, exceeding the limit.
Published on medium.com
قال تعالي: {وَابْتَغِ فِي� َا آتَاكَ اللَّهُ الدَّارَ الْآخِرَةَ ۖ وَلَا تَنسَ نَصِيبَكَ � ِنَ الدُّنْيَا ۖ وَأَحْسِن كَ� َا أَحْسَنَ اللَّهُ إِلَيْكَ ۖ وَلَا تَبْغِ الْفَسَادَ فِي الْأَرْضِ ۖ إِنَّ اللَّهَ لَا يُحِبُّ الْ� ُفْسِدِينَ} [ القصص — 77 ]
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 performed a non-atomic check-then-act: it counted existing keys and then inserted a new one without locking, so concurrent requests all saw a count below the limit.
Impact
An attacker could create more API keys than the intended limit, potentially increasing attack surface and enabling abuse of APIs at scale, though the text does not specify further consequences.
What the attacker needed
A free account; ability to send concurrent requests
How it was found
- Intercept the request that generates a new API key.
- Duplicate the request many times (around 40–50).
- Group the duplicated requests together.
- Send them in parallel using Burp's single packet attack.
- Refresh the API keys page to see the extra keys created.
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 a rule and then acts on it, but two requests can both pass the check before either finishes. Here, the server checked the key count, saw it was under 10, and allowed creation, but many requests did this at once. The result was more keys than the limit allowed.
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.