Skip to content
Race condition Write-up Intermediate

Race Conditions with pipelining

The website allowed only one video to be prepared for download at a time, but by using HTTP pipelining to send multiple requests simultaneously, an attacker could prepare multiple videos at once. This bypassed the intended limit.

Abbas Heybati Follow

Published on infosecwriteups.com

Hi guy’s Approximately a year ago, I identified a race condition using pipelining technique that allowed me to add a significant number of videos to my dashboard on the website. You were restricted to adding only one video to your dashboard.

Abbas.heybati, on infosecwriteups.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

About a year before writing this up, the author found a race condition on a website that let him add far more videos to his dashboard than the site allowed. The feature in question prepares a video for download: the site's policy permitted only one video to be prepared for download at a time. The report does not name the company or the site, and the author notes that the bug no longer exists there and that the documents he is showing are old.

The write-up exists for one reason: to show that a race condition can be exploited with HTTP pipelining. The author says he tried many other methods and none of them worked, while pipelining did.

Setup

The report gives no account details, no roles and no tool versions. What it does describe is the tooling he tried before pipelining:

  • Burp Intruder.
  • Other tools available on GitHub.
  • Manual techniques.

None of these produced the result. He also notes that at the time, James Kettle had not yet presented his newer method for race conditions, so the only idea he had was to send requests to the server simultaneously in the shortest possible time. He emailed James Kettle about the finding, and Kettle's enthusiastic response encouraged him to write the report.

Finding it

The starting point was the request log. Looking through the traffic, he identified that videos are prepared in the endpoint POST /video/generate. That is the request where videos are prepared, and it is the request he wanted to send twice at once.

Check Request From the original on infosecwriteups.com

The screenshot shows the request he inspected, captioned Check Request.

Exploitation

Step 1: choose a request to pipeline behind

He first needed a request to test the technique with, so he tested pipelining once to see if it worked correctly. He tried various methods for pipelining, such as option/trace, but got better results with GET /images/apple-touch-icon.png. He then ran a pipelining test against that endpoint to see whether it worked correctly.

Test pipelining From the original on infosecwriteups.com

The screenshot, captioned Test pipelining, shows that test.

Step 2: pipeline the real request

Once he was confident in the method and the endpoint, he moved to the main test: he sent the original request that creates videos, pipelined together with the added request, so that both reached the server in the shortest possible time.

Final Request pipelining From the original on infosecwriteups.com

The screenshot, captioned Final Request pipelining, shows the final request. The author notes that the second response is not visible in the picture.

Result

He was able to prepare two videos for simultaneous download. He adds a hedge: this worked here, but you could not do the same in different situations. He found it interesting that such a capability exists through pipelining at all.

Root cause

The report does not include any code or server-side explanation, so the mechanism can only be inferred. The report gives no server-side explanation, so the mechanism is not known. When two requests arrive close enough together, both pass the check before either has recorded its result, and both videos are prepared. The report does not explain why pipelining succeeded where other methods did not.

Why the other approaches failed is not explained beyond the author's statement that they did not work. The report does not analyse this further.

Impact

An authenticated user subject to a one-video limit could prepare more videos than the policy allows, in this case two at once. The author frames the impact in terms of that limit only: the restriction on preparing videos for download was bypassed. The bug no longer exists at the company, and the author notes you could not do this in different situations.

Fix

The general fix for this class of bug is to make the check-and-act sequence atomic, for example with a database-level lock or a unique constraint on the resource being created, so that two concurrent requests cannot both pass the limit check. The report does not confirm which of these was applied.

Variants to test

  1. Any endpoint that enforces a per-user quota. Look for requests that create, prepare or claim a limited resource, such as a video render, an export, an invite or a coupon redemption. A positive result is two resources created from two pipelined requests where the UI or policy allows one.
  2. Pipelining behind a cheap static request. Use a small, cacheable asset on the same host as the warm-up request, as the author did with the icon, and confirm the server processes pipelined requests in order before sending the real pair. A positive result is both responses arriving in the expected order on one connection.
  3. Different warm-up methods. The author tried option/trace before settling on GET. If GET does not behave as expected, try other methods against the same host and watch whether the second request is still processed promptly.
  4. Compare against non-pipelined concurrency. Send the same pair from separate connections or through Intruder and compare. If only the pipelined pair succeeds, the window is narrow and the server is serialising per connection rather than per user, which points at the same root cause.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

What happened, in plain words

A website let each user prepare one video for download at a time. The author found a way to make the site prepare two videos at once, breaking that limit. The trick was to send two requests to the server so close together that both were processed, breaking the limit. This kind of bug is called a race condition: two actions run at the same moment and trip over each other.

The technique that made it work is called HTTP pipelining. Normally your browser sends one request, waits for the answer, then sends the next. Pipelining means putting several requests on the same connection back to back, without waiting, so the server starts on the second while it is still handling the first.

The author wrote this up to show that a race condition can be exploited with pipelining. He had tried other tools and methods first and none of them worked. He also emailed James Kettle about the finding, and Kettle's enthusiastic reply encouraged him to publish it. The report does not name the company or the site, and the author says the bug no longer exists there; the screenshots are old.

Background ideas you need first

A few everyday ideas make the rest easier to follow.

  • Request and response. When you use a website, your browser sends a request ("please give me this page" or "please create this video") and the server sends back a response (the page, or a confirmation). Think of it as posting a letter and getting a reply.
  • API endpoint. An endpoint is a specific address on the server that does one job, such as creating a video. It is like a counter in a shop: you go to the counter for the service you want. The report writes endpoints like POST /video/generate, where POST is the type of request ("please create something") and the rest is the address.
  • Dashboard. The private area of a website you see after logging in, where your own items are listed. Here it is where the prepared videos appear.
  • Quota or limit. A rule that says you may only do something a certain number of times, for example prepare only one video at a time.
  • Race condition. A bug where two actions happen at almost the same instant and the program's check for one does not yet know about the other. A simple comparison: two people reach the last seat on a train at the same moment, both look, both see it free, and both sit down. The check ("is the seat free?") and the action ("sit down") were not done as one indivisible step.
  • HTTP pipelining. Sending several requests on one connection without waiting for each reply. The server is expected to answer them in order. It is like handing a shop assistant three items at once instead of one at a time.
  • Burp Intruder. A feature of Burp Suite, a tool security testers use to capture and replay web traffic. Intruder sends many variations of a request automatically. The author tried it here and it did not produce the result.

Finding the request to attack

The author started by looking at the traffic between the browser and the site, that is, the list of requests the site makes as you use it. In that list he found that videos are prepared by the endpoint POST /video/generate. That is the request where videos are prepared, so it is the request he wanted to send twice at the same moment.

Check Request From the original on infosecwriteups.com

The screenshot is captioned Check Request and shows the request he inspected.

Trying other methods first

Before pipelining, he tried several other ways to get two requests to land together:

  1. Burp Intruder.
  2. Other tools available on GitHub.
  3. Manual techniques, meaning doing it by hand.

None of them worked. He also notes that at the time, James Kettle had not yet presented his newer method for race conditions, so the only idea he had was to send requests to the server simultaneously in the shortest possible time. That is the goal of every race condition attack: make the gap between the two actions as small as possible.

Step 1: test pipelining with a harmless request

Before touching the real endpoint, he tested pipelining once to see if it worked correctly. He tried various methods for pipelining, such as option/trace, but got better results with GET /images/apple-touch-icon.png. That address is an image file on the site. He then ran a pipelining test against it to see whether it worked correctly.

Test pipelining From the original on infosecwriteups.com

The screenshot is captioned Test pipelining and shows that test.

Step 2: pipeline the real request

Once he was confident in the method and the endpoint, he moved to the main test. He sent the original request that creates videos, pipelined together with the added request, so that both reached the server in the shortest possible time.

Final Request pipelining From the original on infosecwriteups.com

The screenshot is captioned Final Request pipelining and shows the final request. The author notes that the second response is not visible in the picture.

The result

He was able to prepare two videos for simultaneous download, where the site's policy allowed only one. He adds a caveat: this worked here, but you could not do this in different situations. He found it interesting that such a capability exists through pipelining at all.

Why it worked

The report gives no code and no server-side explanation, so the mechanism can only be inferred. The report gives no server-side explanation, so the mechanism is not known. When two requests arrive close enough together, both pass the check before either has recorded its result, and both videos are prepared. The report does not explain why pipelining succeeded where other methods did not.

Why the other approaches failed is not explained beyond the author's statement that they did not work. The report does not analyse this further.

What the impact was

A logged-in user who is subject to a one-video limit could prepare more videos than the policy allows, in this case two at once. The author frames the impact in terms of that limit only: the restriction on preparing videos for download was bypassed. The bug no longer exists at the company, and the author notes you could not do this in different situations.

How it would be fixed

The general fix for this class of bug is to make the check-and-act sequence atomic, meaning it happens as one indivisible step, for example with a database-level lock or a unique constraint on the resource being created, so that two concurrent requests cannot both pass the limit check. The report does not confirm which of these was applied.

Variants to test

  1. Any endpoint that enforces a per-user quota. Look for requests that create, prepare or claim a limited resource, such as a video render, an export, an invite or a coupon redemption. A positive result is two resources created from two pipelined requests where the UI or policy allows one.
  2. Pipelining behind a cheap static request. Use a small, cacheable asset on the same host as the warm-up request, as the author did with the icon, and confirm the server processes pipelined requests in order before sending the real pair. A positive result is both responses arriving in the expected order on one connection.
  3. Different warm-up methods. The author tried option/trace before settling on GET. If GET does not behave as expected, try other methods against the same host and watch whether the second request is still processed promptly.
  4. Compare against non-pipelined concurrency. Send the same pair from separate connections or through Intruder and compare. If only the pipelined pair succeeds, the window is narrow and the server is serialising per connection rather than per user, which points at the same root cause.

Glossary

  • API endpoint: a specific address on a server that performs one job, such as creating a video.
  • Atomic: done as one indivisible step, so nothing else can slip in halfway through.
  • Burp Intruder: a feature of the Burp Suite testing tool that sends many variations of a request automatically.
  • Cacheable asset: a small file, such as an image, that a server or browser can store and reuse instead of regenerating it.
  • Concurrent requests: requests that are being handled at the same time rather than one after another.
  • Dashboard: the private area of a website where a logged-in user sees their own items.
  • Endpoint: see API endpoint.
  • GET: the type of HTTP request used to fetch something, such as a page or an image.
  • HTTP pipelining: sending several requests on one connection without waiting for each reply, with the server expected to answer in order.
  • POST: the type of HTTP request used to send data and ask the server to create or change something.
  • Quota: a rule limiting how many times a user may do something.
  • Race condition: a bug where two actions happen at almost the same instant and a check for one does not yet know about the other.
  • Request: the message a browser sends to a server asking it to do something.
  • Response: the message a server sends back after handling a request.
  • Root cause: the underlying reason a bug exists, as opposed to its visible symptom.
  • Serialising: making requests wait their turn so they are handled one at a time.
  • Unique constraint: a database rule that refuses to store two records with the same identifying value, which can stop duplicates being created at once.

More by Abbas Heybati

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.