Skip to content

Signature-Based Authorization Without Expiry

SAFE-0229 Signatures Checked automatically by the scanner
1

What goes wrong

An off-chain signed authorization (allow-mint, gasless action) carries no expiry timestamp. A leaked or old signature stays valid forever, so a single exposure permanently grants the action.

2

The vulnerable pattern

proof of concept — how it is exploited
// signature over (user, MINT) with no expiry leaks from a log.
// anyone replays it months later to mint for 'user' -> still valid.
3

How to fix it

the pattern that is safe
require(block.timestamp <= expiry, "expired");
bytes32 digest = _hash(user, action, expiry, nonces[user]++);
Bind every off-chain authorization to an expiry + nonce.
Check your own contract for this

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