Skip to content
Race condition Write-up Intermediate

Taming Post Claps

A race condition in the clap endpoint allowed a user to send concurrent requests that each read the same clap count and then added claps, bypassing the 0-50 limit. An attacker could inflate or deflate clap counts on posts, though the text states this did not affect earnings or recommendations.

medium.com

Published on medium.com

A user was able to exploit a race condition in our backend system to manipulate clap counts on posts. Users are supposed to only be able to clap between 0 and 50 times for a given post, but this hack allowed them to go outside those bounds (both above and below).

Ryan Lattanzi, on medium.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.

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 clap update used an unconditional write that read the existing count and added to it without checking if another request had modified the value in between.

Impact

The bug could make a post display incorrect clap counts (including negative values shown as zero), but the text states it did not affect partner program earnings or recommendations, and normal users could not reproduce it via the UI.

What the attacker needed

Ability to send concurrent requests; a post to clap on

How it was found

  1. Send a burst of concurrent requests to the clap endpoint, each adding claps to the same post.
  2. Multiple requests read the same existing clap count before any write occurs.
  3. Each request adds its claps to the stale count, resulting in a total above 50.
  4. Some later requests see the inflated count and are rejected, but the damage is done.

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 two actions occur at almost the same time and interfere with each other. Here, many clap requests arrived together, each read the same starting number, and each added claps, so the total went over the allowed limit. The fix makes each update check that the number has not changed since it was read.

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.

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.