The Ravens wallet has a welcome voucher that adds credit once. But the server never records that the voucher was used, so you can redeem it again and again, each time increasing your balance.
A wallet with a feather balance and a one-time welcome voucher. Each redeem adds fifty, but the server never marks the voucher used, so you can repeat the redeem.
You redeemed the voucher more than once and inflated your balance.
Why the solution worked
The voucher is one-time by design, but the implementation records no usage state, so there is no difference between the first redeem and the tenth. One-time operations need a flag stored on the server to prevent repeats.
The root cause
No idempotency check: the voucher is never marked used. The root is not recording usage state for a one-time operation.
How the code is fixed
One-time operations need an atomic consume of the code that fails if already used.
Vulnerable code
app.post('/redeem', (req, res) => {
if (req.body.code === VOUCHER) addCredit(50); // never marked used
});
Safe code
app.post('/redeem', (req, res) => {
// Atomically consume the voucher: the update fails if it was already used.
const ok = vouchers.consumeOnce(req.body.code, req.user.id);
if (ok) addCredit(50);
});
Impact in the real world
Reusing vouchers and rewards drains money and has been abused in points and gift programs at scale.
How defenders detect it
Defenders mark the voucher used atomically and alert on repeated redeems of the same code by one account.
Your workspace now has a Server logs tab: your own attack, as the defender saw it, with the alerting lines marked.
Solved with the walkthrough. Put it aside and solve again to earn the feather.