agentleFS
fennihfennih/hunterkit/race/SKILL.md

race

Skill0 starsChanged 6 days agoMITView on GitHub

Focused hunt for race conditions and TOCTOU on web targets: single-use resource redemption, balance math, limit checks, and state-machine races. Small controlled bursts with curl/ffuf, single-packet style where possible. Use when the focus is race conditions. Not for general business logic that needs no concurrency (use business-logic).

  • Sends data out

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Mode: default burst 5–20 requests.

    line 20
  2. Very specific:

    If success needs no concurrency → report under business-logic instead, with the serial proof.

    line 59

≈ “Common” is an estimate: at least 1 in 5 of the 383,637 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Race Conditions / TOCTOU

When to use

  • "Test race conditions on X", "can I redeem this coupon twice"
  • Single-use or check-then-act resources: coupons, bonuses, votes, withdrawals, transfers, gift cards, stock, signup limits, email verification

When NOT to use

  • Non-concurrent logic bugs (business-logic)

Inputs

  • Target + the endpoint to race; your own resources only (own coupon, own balance)
  • Mode: default burst 5–20 requests; the user may allow larger bursts

Rationalizations to reject

  • "One of 50 requests succeeded twice" — analyze before celebrating: was it a race, or does the endpoint simply lack dedup (a plain logic bug, no concurrency needed)? Report the actual root cause class.
  • "Timing jitter proves the race" — the finding is the outcome (two successes against a one-use rule), not request timing.
  • "More concurrency = more findings" — no. After a clean negative at 20, the window is likely closed or protected; report coverage and stop.

Methodology

1. Identify the check-then-act window

Where the server reads state, decides, then writes: SELECT balance → UPDATE balance, if !coupon.used → mark used. Any gap is a candidate. Multi-step flows (initiate → confirm) widen windows.

2. Baseline first

Single request: success. Single repeat: blocked (the rule works serially). This proves the resource is single-use — required before racing.

3. Burst mechanics

  • curl parallel: seq 1 N | xargs -P N -I{} curl -s -X POST <url> -d ... -o out{}; N=5..20 default.
  • ffuf if installed: wordlist of N identical lines, -t N, one URL — request timing aligns at connect.
  • Python socket-level if precision needed (single-packet-ish alignment: pre-connect, send bodies back-to-back).
  • Record every response. Count successes vs the rule.

4. Classic patterns

  • Double redemption: coupon/gift/vote/withdrawal (own resources).
  • Balance race: two concurrent withdrawals where each passes amount <= balance but sum exceeds it. Use small amounts; abort before real settlement if possible (ask user if money is at stake).
  • Limit race: free-tier limits (5 exports/day) — 20 parallel exports, count granted.
  • State machine: cancel + use concurrently (cancel subscription while redeeming the included credit), delete + access concurrently (token revocation window).
  • Email verify race: request two codes / verify + change email concurrently.

5. Analysis

  • Successes > rule allows = confirmed. Record request count, successes, and the exact rule broken.
  • 0/20 successes: note "window closed at 20 parallel" in coverage, don't retry endlessly. If the two-step flow suggests a wider window (initiate-then-confirm), one targeted retry with alignment on the confirm step.

Reporting

findings/race-<date>.md: the rule, baseline proof (serial repeat blocked), burst size, successes, requests. Severity: money/inventory at scale = high; quota abuse = medium.

Focus discipline

If success needs no concurrency → report under business-logic instead, with the serial proof.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.