Skip to content

approve() Reverts on Non-Zero Allowance (USDT-style)

SAFE-0209 Token Standards Checked automatically by the scanner
1

What goes wrong

The code calls approve(spender, x) on tokens (like USDT) that revert when the current allowance is non-zero. Any second approval reverts, permanently blocking the integration for that token.

2

The vulnerable pattern

proof of concept — how it is exploited
// first approve(spender, 100) ok.
// later approve(spender, 200) on USDT -> reverts because allowance != 0
// -> the vault can never re-approve; deposits stuck.
3

How to fix it

the pattern that is safe
token.safeApprove(spender, 0);
token.safeApprove(spender, amount);
// or forceApprove / increaseAllowance
Reset to zero first, or use forceApprove.
Check your own contract for this

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