Skip to content
high DeFi Economic No SWC entry CWE-841

Duplicate Claim / Claim Without State Update

SAFE-0068 DeFi Economic Checked automatically by the scanner
1

What goes wrong

A claim/redeem function pays out without marking the claim consumed or updating balances before the transfer, so it can be called repeatedly (often combined with reentrancy) to drain.

2

How to fix it

the pattern that is safe
function claim() external nonReentrant {
    uint a = owed[msg.sender]; owed[msg.sender] = 0; // clear first
    token.safeTransfer(msg.sender, a);
}
Clear entitlement before payout; guard reentrancy.
Check your own contract for this

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