Skip to content

Missing ecrecover Zero-Address / Malleability Check

SAFE-0046 Signatures Checked automatically by the scanner
1

What goes wrong

ecrecover returns address(0) for invalid signatures; if unchecked and signer can be 0, auth is bypassed. Raw signatures are also malleable (s,v variants) enabling a second valid signature.

2

How to fix it

the pattern that is safe
address s = ECDSA.recover(h, signature); // rejects 0 and high-s
require(s == signer, "bad sig");
SWC-117. Use OZ ECDSA; never trust raw ecrecover.
Check your own contract for this

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