race-conditions
Skill2 starsChanged 17 days agoMITView on GitHub
Race conditions for a Mythos engagement - limit overrun on a once-only action (coupon, invite, withdrawal, MFA attempt counter), the HTTP/2 single-packet attack, and TOCTOU on a two-step flow - each measured as a hit rate over repeats with a Wilson interval, against a sequential control that must not overrun, judged by the authoritative state read back as the object's owner. Use when the surface shows a redeem, coupon, invite, vote, transfer, withdraw, confirm or two-step approve route, on objects the agent created itself. Never on another user's object and never on a destructive action.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- emre-guler/websectheir own version, first seen Aug 27, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- emre-guler/websec★ 2same name
- conjure-3301/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- account-takeoverSkill
- ai-appSkill
- api-protocolsSkill
- auth-sessionSkill
- business-logicSkill
- cache-poisoningSkill
- client-sideSkill
- cloud-exposureSkill
- continuousSkill
- cve-deep-diveSkill
- deep-serverSkill
- desyncSkill
- engagement-setupSkill
- exploitSkill
- oauth-auditSkill
- reconSkill
- reportSkill
- research-ingestSkill
- source-reviewSkill
- sso-federationSkill
- stored-xss-oastSkill
- supply-chain-inventorySkill
- supply-chainSkill
- takeoverSkill
- tenant-isolationSkill
- toolboxSkill
- trafficSkill
- web-scanSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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
- Very specific: line 32
Read knowledge/web/race-conditions.md before step 2: it carries the single-packet mechanics, the statistics rule and the sources.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
Race conditions: one success is not a finding
A check and the state change it guards are not atomic, so requests that arrive together all pass the check. That part is easy. The hard part is that a race is stochastic: the same burst against the same endpoint overruns sometimes and not others, the response bodies lie in both directions (200 without a write, 409 after one), and a tester who stops at the first double-success reports noise as a finding roughly as often as not.
So this skill is mostly about the measurement, and scripts/race encodes it
rather than asking you to remember it:
- the oracle is the authoritative endpoint read back as the owner, before and after every wave. A racing response body is never evidence.
- a sequential control of the same N requests runs for every repeat and must let exactly one through. If it overruns, the endpoint was never once-only and nothing can be attributed to concurrency.
- the result is a hit rate over whole repeats with Wilson and
Clopper-Pearson intervals.
candidaterequires the parallel arm's 95% lower bound to clear the control's 95% upper bound. 6/6 against 0/6 clears it; 3/3 against 0/3 does not and comes backinconclusive, which is a result and goes in the report as one. - this script never writes
confirmed, and never writescandidateinto a finding either. It prints a verdict and records the bytes; the validate phase replays them on another model.
Read knowledge/web/race-conditions.md before step 2: it carries the
single-packet mechanics, the statistics rule and the sources.
Preconditions, and what is refused
- Sessions from auth-session: the burst goes out as your identity, and the read-back must be done as the owner or it proves nothing about whose state moved.
- An object you own.
scripts/racereads--owner-urlas the owner before every wave and refuses when the object id is not in what comes back. There is no flag for this. - A non-destructive action, unless the object was minted by this
invocation through
--setup-url. A destructive verb (delete, cancel, revoke, refund, transfer-out…) on an--objectthat predates the run is refused, and data destruction, brute force and denial of service are refused in every mode byhooks/budget-guard.py. scope.yamlnames the host. A scope warning arrives after a burst has landed, so here it is a refusal.- Load. A race is load by nature. With the defaults (
--n 8,--repeats 6) one subcommand sends 132 requests, of which 48 arrive in six bursts of 8. The sequential control, the setups and the read-backs honourrules.rate_limit_rps; the parallel burst is bounded by N and by nothing else, because arriving together is the experiment. N is 2..20 by default;MYTHOS_RACE_MAX_Nraises the ceiling to at most 50 for a lab you own. If the programme's rules do not permit a burst of N, do not run this and recordskippedwith that reason.
1. Find the aim points, and the counter that proves them
From surface.json and the app's own flows, list the actions that may succeed
once: redeem, claim, invite, vote, withdraw, apply-coupon, signup-bonus,
confirm, approve, and any MFA or rate-limit attempt counter. For each one write
down three things in scan/race-aim.md:
- the action request (method, URL, body), with
{{R}}where the object id goes; - the endpoint that mints a fresh object of that kind, and the field of its answer that carries the new id;
- the authoritative counter: an endpoint that states the balance, the redemption count or the usage count, and a regex whose group 1 is the number.
Without the third one there is nothing to measure and the aim point is
skipped, not tested. An action whose effect is only visible in its own
response cannot be proven here.
2. Limit overrun, with the control
scripts/race limit --url http://t/redeem --method POST --data '{"code":"{{R}}"}' \
--setup-url http://t/coupon/new --setup-field code \
--owner-url http://t/mine \
--state-url http://t/balance --count-regex '"redemptions":\s*(\d+)' \
--header 'Authorization: Bearer <own token>' \
--n 8 --repeats 6 --dir engagements/<dir> --jsonPer repeat it mints a fresh object, proves you own it, reads the counter, runs
the sequential control, then does the same again for the parallel wave. Flags
worth knowing: --engine h1|h2|auto, --unit (how far the counter may
legitimately move in one wave, default 1), --success-regex and
--success-status (diagnostics only — they never decide the verdict),
--object instead of --setup-url for a counter that resets rather than an
object that is consumed, --rate, --timeout, --insecure.
Exit codes: 0 candidate, 1 no-signal, 2 usage, 3 inconclusive,
4 refused.
3. The single-packet attack
Last-byte sync still sends N segments that cross the network independently, so jitter staggers them. The single-packet attack puts the final frame of every request in one TCP segment, so the server sees them all within one read:
scripts/race single-packet --url https://t/redeem --data '{"code":"{{R}}"}' \
--setup-url https://t/coupon/new --setup-field code \
--owner-url https://t/mine \
--state-url https://t/balance --count-regex '"redemptions":\s*(\d+)' \
--header 'Authorization: Bearer <own token>' \
--n 20 --repeats 6 --insecure --dir engagements/<dir> --jsonIdentical protocol to limit; only the parallel wave differs. It needs ALPN
h2 over TLS and falls back to HTTP/1.1 last-byte sync when the URL is not
https, when the peer negotiates something else, or when the peer's
MAX_CONCURRENT_STREAMS is below N. Read sync_mode in the output: a
no-signal under h1-last-byte-sync is much weaker than one under
h2-single-packet, and fell_back_from_h2 says why it fell back. --settle-ms
is the pause between parking the streams and releasing them (default 120).
4. TOCTOU on a two-step flow
Confirm-then-use, check-then-write, reserve-then-charge: step one leaves the object in a state step two consumes, and the gap is the window.
scripts/race toctou --first http://t/order/confirm --first-data '{"id":"{{R}}"}' \
--second http://t/order/use --data '{"id":"{{R}}"}' --gap-ms 0 \
--setup-url http://t/order/new --setup-field id \
--owner-url http://t/mine \
--state-url http://t/balance --count-regex '"uses":\s*(\d+)' \
--header 'Authorization: Bearer <own token>' \
--n 8 --repeats 6 --dir engagements/<dir> --json--first goes out once per wave, then the burst of --second after
--gap-ms. Sweep the gap: 0, 20, 100, 250. A window that only opens at
one gap size is still a window, and the gap that found it belongs in the
finding.
5. Write it up, or write down that it did not hold
A candidate goes in candidates/<id>.md with:
- the verdict and the interval, not the fraction: "6/6 repeats overran, 95% CI 61%–100%, control 0/6, exact upper bound 46%";
- the sync mode that produced it, and the fallback reason if there was one;
- the counter that moved, the endpoint it was read from, and that it was read as the owner;
- the
traffic/<id>of the parallel burst and of the sequential control.scripts/traffic show <id>prints the bytes andscripts/traffic replay <id>resends them, which is what the validator does. For a single-packet wave the whole connection is one record, preface included, so a replay re-runs the whole burst.
inconclusive and no-signal are results. Write them down with the N, the
repeats and the mode that ran, and say what would change the answer (more
repeats, a wider N, h2 instead of h1, a different gap). "Did not reproduce at
N=8 over 6 repeats under last-byte sync" is worth far more to the next run than
silence.
Checks before you move on
- every aim point either has a verdict or a
skippedwith a reason - no verdict rests on a racing response body
- every
candidatehas a clean sequential control in the same run - every rate is reported as an interval
sync_modeis stated next to every verdict- every object raced was one you own, and no destructive action was raced
scripts/race selftestpasses (it asserts the HPACK and frame bytes and runs the whole protocol against a loopback server with a real race window)
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
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.

