Skip to content

Missing Zero-Address Validation on Critical Setter

SAFE-0140 Input Validation Checked automatically by the scanner
1

What goes wrong

A setter for a critical address (owner, treasury, oracle, implementation) does not reject address(0). A fat-finger or a malicious call can null out a core dependency, permanently bricking the flow that depends on it.

2

The vulnerable pattern

proof of concept — how it is exploited
// setOracle(address(0))
// every price read now calls address(0) -> reverts (or returns 0),
// freezing deposits/withdrawals until (if) it can be reset.
3

How to fix it

the pattern that is safe
function setTreasury(address t) external onlyOwner {
    require(t != address(0), "zero addr");
    treasury = t;
}
Zero-check every critical address setter.
Check your own contract for this

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