At a glance
- Controls
- CWE-362
What it is
A refund flow reads the balance, checks it, then writes the credit. If two requests run between the read and the write, both see the same starting state. Each one passes and each one pays.
An attacker sends many identical requests in a single burst to hit that small window. AI-assisted tooling can script and time these bursts with little effort, so race windows are tested far more often than before.
Where it hides
What a reviewer can look for in the code and in the behaviour, before anyone proves it.
- Refund and cancellation endpoints
- Payout and withdrawal requests
- Credit, voucher and gift card redemption
- Background jobs that settle pending refunds
How MATT tests it
The proof runs against the deployed product, on every release, whoever wrote the code.
- 01Sign in with the test account and place a test-mode order that can be refunded.
- 02Send several identical refund requests for that order at the same moment.
- 03Check the order and account ledger to count how many credits were applied.
A refund, payout or credit must be applied exactly once.
Executable checkas test user: send 10 parallel POST /v1/orders/{id}/refund expect: at most one 200 expect: the others return 409 or the same refund id expect: exactly one refund entry in the ledger for the order
Every rule MATT holds →What the fix looks like
- 01
Require an idempotency key on every refund, payout and credit request.
- 02
Lock the order or balance row during the check and the write.
- 03
Add a unique constraint so one order can hold only one refund of each kind.
- 04
Reconcile the ledger daily and alert on duplicate credits.
A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →