Bypassing a Monthly Secure Message Limit Using a Race Condition
The application enforces a monthly limit of five secure messages per user, but the server checks the remaining count and then creates the message without synchronising these steps. An attacker can send several requests at the same moment so that more than five messages are created before the counter is updated.
Published on medium.com
Many applications enforce usage limits as part of their business logic. In my testing application, each user is allowed to send only 5 secure messages per month.
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 checks the remaining message count and then creates the message and updates the counter in separate, non-atomic steps, so concurrent requests can all pass the check before any update occurs.
Impact
An attacker could bypass the monthly secure message limit, abuse a restricted or premium feature, consume system resources unfairly, and increase operational or support costs; rate limiting does not prevent the business rule from being violated.
What the attacker needed
A valid user account; remaining messages at the limit edge
The fix
The limit should be enforced with atomic server-side checks, using database transactions or locking when validating and updating the message counter, and rejecting requests once the limit is reached.
How it was found
- Log in with a valid user account.
- Reach the limit edge case where only one message remains.
- Capture the create-message request and send it to Burp Repeater.
- Duplicate the request tab about ten times and set the send mode to parallel.
- Send the group and observe that more than five messages are 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 server handles several requests at the same time and does not lock the shared counter while checking and updating it. Because the check and the update are separate, multiple requests can all see that one message remains and all succeed. This lets a user send more messages than the monthly limit allows.
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.