Skip to content
high DeFi Economic No SWC entry CWE-294

Double-Spend Logic / Nonce Reuse

SAFE-0069 DeFi Economic Checked automatically by the scanner
1

What goes wrong

Off-chain or on-chain vouchers/nonces are not strictly consumed, or a nonce is reused/not incremented, allowing the same authorization to spend funds twice.

2

How to fix it

the pattern that is safe
function redeem(uint nonce) external {
    require(!used[nonce], "used"); used[nonce] = true; pay(msg.sender);
}
Strictly consume nonces/vouchers exactly once.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0069 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs