Skip to content

Reentrancy Guard Not Applied to Every External State-Changer

SAFE-0305 Reentrancy Checked automatically by the scanner
1

What goes wrong

The contract defines a nonReentrant guard but at least one external state-changing function that makes value transfers is missing it. Attackers re-enter through the unguarded function, bypassing the protection the guard implies.

2

The vulnerable pattern

proof of concept — how it is exploited
// withdraw() is nonReentrant, but claim() (also sends ETH) is not.
// attacker re-enters via claim() during the external call, draining funds
// the guard was meant to protect.
3

How to fix it

the pattern that is safe
// apply nonReentrant to ALL external functions that move value / mutate
// shared state, not just the obvious withdraw().
A guard on one function is not a guard on the contract.
Check your own contract for this

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