Bypassing File Upload Limits via Race Condition
The support ticketing system enforced a limit of 10 attachments per ticket by checking the current count before saving each upload, without any locking. By sending 20 upload requests in parallel, all passed the check and were saved, bypassing the limit.
medium.com
Published on medium.com
In this write-up, I want to share one of my favorite bug classes to hunt for: race conditions in business logic. Specifically, I’ll walk you through a scenario where I was able to bypass a strict file attachment limit on a support ticketing system by sending parallel requests at just the right moment.
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
The attachment count check and the save operation were not atomic, so concurrent requests could all pass the check before any save occurred.
Impact
An attacker could upload more files than the documented limit, potentially leading to storage abuse or resource exhaustion.
What the attacker needed
Ability to create a ticket; ability to send parallel HTTP/2 requests
How it was found
- Start a new ticket and intercept a single file upload request.
- Send the request to Burp Repeater.
- Duplicate the request about 20 times.
- Group the tabs and use 'Send group in parallel (single connection)'.
- Send the group and observe that all requests return 200 OK.
- Refresh the ticket to see all 20 attachments uploaded.
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 another request can sneak in between the check and the action. Here, the system counted existing files, saw fewer than 10, and then saved the new file. By sending many requests at the same instant, they all saw a low count and all got saved, so the limit was broken.
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.