Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of State Machine Abuse?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/blackfoxxx-state-machine-abuse)
---
name: state-machine-abuse
description: "Checkout, auth and redemption flows: step skipping, replay, races"
---
# State-machine abuse (flows, replay and races)
Most high-impact web bugs are not injections; they are a flow that can be walked
in a way the designer did not intend. A checkout that trusts a client price, a
verification step that can be skipped, a coupon that can be redeemed twice under
concurrency — each is a business-logic bug with direct monetary impact.
Authorized engagements only. Use the smallest value that proves the point.
## 1. Map the flow from real traffic
For each money or privilege flow, write the states and transitions:
```
register → verify email → login → add to cart → checkout
→ apply coupon → pay → fulfill → refund
payout: request → approve → paid
auth: login → step-up (OTP) → session elevated
```
For every transition, record: the request, the server-side guard, and the state
it produces. Use `traffic_search` to find the real requests instead of guessing
endpoint names.
## 2. The five failure modes
| Failure | Test |
|---|---|
| **Step skipping** | Call the later transition directly (fulfill/approve/payout) without the earlier one; does the server re-check the prerequisite? |
| **Out-of-order** | Apply a coupon after payment; refund before fulfillment; verify after login. |
| **Replay** | Resend a one-time token, OTP, reset link, or signed callback. Does it stay single-use? |
| **Client-trusted values** | Change price, quantity, currency, discount, role, user id in the request. Does the server re-derive them? |
| **Concurrency** | Fire the same single-use request in parallel (`race_burst`). Does it succeed more than once? |
## 3. Confirming a race
1. Pick one single-use operation with a small value (one coupon, minimum credit).
2. Read the state before (balance, coupon count, order status).
3. Run `race_burst` with a modest count (20). More than one distinct outcome is a
candidate.
4. Read the state after. If the value moved twice, that is the finding.
5. Confirm once more with a second burst, then stop. Do not repeat on a live
balance after the proof.
## 4. Confirming a logic bypass
A price/quantity/role tamper is confirmed only when the **server-side result**
changes: the order total, the granted role, the credited balance. A request that
returns 200 but stores the original value is not a finding.
## 5. Impact statement
State it in money or access terms: "an authenticated user can obtain a €50 gift
card for €0.01", "a standard user can approve their own payout", "the same coupon
can be redeemed N times". Vague "business logic flaw" is not a finding.
## 6. Boundaries
- Never move real funds beyond the minimum proof; if the engagement has a test
account, use it.
- If a proof changes production state, record exactly what changed and revert if
the application allows it.
- A flow that is merely unusual is not a finding. It needs a crossed boundary or
a value that should not have changed.