Skip to content

DoS via Unexpected Revert in Loop / Push Payments

SAFE-0037 Denial of Service Checked automatically by the scanner
1

What goes wrong

The contract pushes funds to a list of recipients in a loop. One recipient that reverts (or is a contract with no receive) blocks the entire batch, freezing payouts for everyone (griefing).

2

How to fix it

the pattern that is safe
mapping(address=>uint256) public owed;
function claim() external {
    uint256 a = owed[msg.sender]; owed[msg.sender]=0;
    (bool ok,)=msg.sender.call{value:a}(""); require(ok);
}
King of the Ether. Use pull-over-push payments.
Check your own contract for this

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