Skip to content

pause()/unpause() Without Access Control

SAFE-0227 Access Control Checked automatically by the scanner
1

What goes wrong

An emergency pause/unpause is public or has no modifier, letting anyone halt (grief) the protocol or, worse, un-pause it during an incident the team is trying to contain.

2

The vulnerable pattern

proof of concept — how it is exploited
// function pause() public { _pause(); }
// attacker calls pause() repeatedly -> the protocol is frozen at will (DoS).
3

How to fix it

the pattern that is safe
function pause() external onlyRole(PAUSER_ROLE) { _pause(); }
function unpause() external onlyRole(PAUSER_ROLE) { _unpause(); }
Gate pause/unpause behind a dedicated role.
Check your own contract for this

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