Skip to content

Locked Ether / No Withdrawal Path

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

What goes wrong

A contract can receive Ether (payable / receive) but has no function to withdraw it, permanently locking any funds sent.

2

How to fix it

the pattern that is safe
receive() external payable {}
function withdraw() external onlyOwner {
    payable(owner).transfer(address(this).balance);
}
Always provide a guarded withdrawal/sweep.
Check your own contract for this

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