Skip to content

UUPS _authorizeUpgrade Unprotected

SAFE-0233 Upgradeability Checked automatically by the scanner
1

What goes wrong

A UUPS proxy's _authorizeUpgrade is empty or unguarded, so anyone can call upgradeToAndCall and replace the implementation with arbitrary code — a complete takeover of the contract and its funds.

2

The vulnerable pattern

proof of concept — how it is exploited
// function _authorizeUpgrade(address) internal override {} // no modifier!
// attacker: proxy.upgradeToAndCall(Evil, initCall)
// -> Evil is now the logic; attacker owns everything.
3

How to fix it

the pattern that is safe
function _authorizeUpgrade(address newImpl) internal override onlyOwner {}
Always restrict _authorizeUpgrade to a trusted role.
Check your own contract for this

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