Race Conditions
Last updated
Was this helpful?
Last updated
Was this helpful?
This can cause data corruption, security vulnerabilities, and system crashes due to the unsynchronized execution of operations.
Implement proper synchronization mechanisms like locks, semaphores, and atomic operations to ensure orderly access to shared resources.
The example below is based on PostSwigger's lab.
The application has a field for inserting a coupon at checkout as well as current coupon that gives us 20% off (Figure 1).
The server prevents coupon abuse, i.e., the same coupon being applied multiple times, when sending the requests sequentially (Figure 2).
We can try testing for a race condition vulnerability by replicating the same request multiple times and sending all simultaneously (Figure 3).
First, we need to understand how the update email process works (Figure 5).
We can test if a collision is possible by sending multiple requests at the same time using different user emails (Figure 6).
Next, we can try to achieve the required collision (Figure 7) and when it does (Figure 8), refreshing the application page will give us access to the admin panel .
The goal here is to essentially try and sneak a product in our cart before the checkout process completes. To be able to checkout in the first place, we need to have a product in our basket (Figure 9).
Then we need to simultaneously send the checkout request along with the request that adds the target item in the cart (Figure 10). This will result at the target item sneaking into the cart before the checkout is complete.
The example below is based on PostSwigger's lab.
The example below is based on PostSwigger's lab.