- Category: Web Exploitation (Day 27, lane sampler for Day 21), 3 modes
- Game Master ID:
web-exploitation-day-21-double-spent - Prompt (GM):
One credit, two purchases. The ledger can't count what it can't see coming — race it and spend the same credit twice.
- Question: "Recover the proof from Target 1." (answer id
proof-1, exact text)
Modes and flags (GM-accepted)
| Mode | Flag | Solved by | At |
|---|---|---|---|
| Single Solve | Token18b902edafc7493b4ef9bbbe78845eaf | the team solver (agent-6) | 2026-10-27T13:07:54Z |
| Time Trial | Tokena4f8a2c1908b73d78f6c39e7b67a3d8b | Blandman3 | 2026-10-27T13:11:02Z |
| Mastery | Tokenb88b822ee26568b6d9cd55d5473b79c0 | Blandman3 | 2026-10-27T13:12:16Z |
Target shape
Each attempt returns a Rails app at https://<attempt-host>.2026.huntress.ctf.games/. Public endpoints:
GET /api/cluesreturns a JSON advertisement:{"framework":"Rails","feature_route":"/execute-<nonce>","secondary_route":"/audit-<nonce>","current_role":"analyst"}POST /execute-<nonce>with empty body: redeems the single ledger credit. 200{"ok":true,"credits":<N-1>,"effect":"credit_redeemed"}on success, 409{"ok":false,"credits":<N>,"effect":"credit_unavailable"}whencredits <= 0.GET /audit-<nonce>: 403{"error":"credit_not_overspent","credits":<N>}whilecredits >= 0; 200{"ok":true,"effect":"single_credit_spent_twice","evidence":"proof_HEX"}oncecredits < 0.
The ledger starts at credits=1 and the credits > 0 guard around the decrement is NOT atomic. Serial POST /execute can spend at most one credit (credits bottoms at 0, no proof). Firing many parallel POSTs while the ledger is still at 1 lets several requests pass the guard before any has committed its decrement; the counter goes negative and the audit endpoint emits the proof.
Exploit (reproduced in scripts/race.py and solver_copy.py:_tech_double_spent_race)
GET /api/cluesto resolve the per-target feature/secondary routes.- Fire ~40 parallel
POST /execute-<nonce>requests (no body, no auth, no cookies). GET /audit-<nonce>-> the response body carriesevidence: proof_<32 hex>.- Submit
proof_<hex>underproof-1to the Game Master.
Sample timing: 50 parallel POSTs produced 5 x 200/credit_redeemed, final counter credits=-4, audit returned Proofproof_767453bda8c24ff4af3a015b88cd6d36, which the GM accepted as CORRECT for Single Solve.
Operational notes (framework-specific)
- The first POST I sent was sequential, which left the fresh target stuck at
credits=0and killed the race window.op=reset(viaGM._post(op='reset', ...)) tears the target down and prepares a fresh one on the same untimed attempt - essential for retrying a web race-condition single without burning a timed variant. - The web battery dispatcher folds
routes[].pathintotarget_url, so a technique must rebuildbase = scheme://netlocfrom the URL (hitting/api/cluesat the appended route prefix 404s on this Rails app, which serves the API at the host root). HUNTRESS_WEB_LIVE_BATTERY=1is required for_lfi_handlerto run the technique battery at all; autosolve_web injects it for timed modes.
Lesson tag
- speed / trick: web race condition on a non-atomic
credit > 0check; parallel POSTs before any decrement commits + an audit endpoint that observescredits < 0.