Case BD0F97 · Web AppSec · L3 Applied
One Coupon, 41 Redemptions
Live alertFinance flags single-use promo WELCOME50 redeemed 41 times by account 88213 at 14:02 UTC. checkout-api logs show 41 POST /cart/apply-coupon requests landing within 30 ms on one HTTP/2 connection.
- 01 What happened?
- 02 What is the impact?
- 03 What do you do?
What a strong answer covers
Try it out loud first. Then check yourself:
- Race condition (limit overrun): check-then-update is not atomic, so parallel requests all pass the unused check
- HTTP/2 single-packet attacks make requests arrive together, so a tiny race window is reliably exploitable
- Impact: direct financial loss; hunt logs for the same pattern on gift cards, refunds, transfers and other one-time actions
- Contain: disable the code, void fraudulent orders, suspend linked accounts; preserve logs and order records
- Fix: atomic conditional update or unique constraint, row locks (SELECT FOR UPDATE), and idempotency keys
If the interviewer pushes back
- Why does rate limiting per user not fix this class of bug?
- Where else in a typical app would you look for the same check-then-act pattern?