Skip to content

Missing Nonce — Signature Replay

SAFE-0113 Signatures Checked automatically by the scanner
1

What goes wrong

A signed message (permit, claim, meta-tx) is verified without consuming a per-signer nonce. The same signature can be replayed to repeat the privileged action — claim an airdrop many times, or re-execute a withdrawal.

2

The vulnerable pattern

proof of concept — how it is exploited
// signature over (user, 100) has no nonce.
// attacker resubmits the identical (user,100,sig) N times.
// claim() pays 100 each time until the contract is drained.
3

How to fix it

the pattern that is safe
bytes32 digest = _hash(user, amount, nonces[user]++);   // consume nonce
require(_recover(digest, sig) == user, "bad sig");
Bind every signature to a monotonically-increasing nonce.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0113 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