Skip to content

Single-Step Critical Role Transfer

SAFE-0226 Access Control Checked automatically by the scanner
1

What goes wrong

A critical role/owner is transferred in a single step to a raw address. A typo sends control to an address nobody holds the key to, permanently losing admin — a two-step accept pattern prevents this.

2

The vulnerable pattern

proof of concept — how it is exploited
// transferOwnership(0xABC...typo) -> admin now an unowned address,
// every onlyOwner function is bricked, no recovery.
3

How to fix it

the pattern that is safe
// two-step: propose then the new owner must accept
function transferOwnership(address n) public override onlyOwner { _pending = n; }
function acceptOwnership() external { require(msg.sender == _pending); _transfer(_pending); }
Use Ownable2Step for critical ownership transfers.
Check your own contract for this

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