Approve drainer: one unlimited approve - and tokens leave whenever the attacker wants
This is the base drain vector that permit,
Permit2 and
signature phishing build on. One
approve(spender, max) leaves standing, unbounded authority over your tokens, and the
attacker moves the whole balance in a separate transaction whenever they want - with no new prompt and with
no action from you at the moment of theft. The danger is not the approve itself, but the
authority it leaves behind.
What approve does
On an ERC-20 token, approve(spender, amount) gives the address spender the right
to move up to amount of your tokens via transferFrom. This is how swaps,
bridges and marketplaces work: first you allow a contract to spend the token, then it spends it. For
convenience, wallets and apps often ask for amount = type(uint256).max - "unlimited", so they
never have to ask again. The approve transaction itself looks harmless: 0 ETH leaves, no
transfer is shown - but it leaves a long-lived right over your tokens.
Why "unlimited" is so dangerous
With a classic ERC-20, transferFrom does not decrement an allowance equal to
type(uint256).max. So one unlimited approve = perpetual access: it can be
spent any number of times, with no further confirmation. The size of the loss is set not by what you do
at the moment of theft, but by the allowance you once granted: a limited approve caps the
loss at that amount, an unlimited one at "everything, forever", until you explicitly revoke.
(1) You are led to approve(spender, max) under the guise of "connect wallet", "enable
trading", "claim your reward" (often through a fake airdrop). (2) Nothing on screen looks alarming - 0 ETH,
an "approval". (3) Later, in a separate transaction, the attacker calls
transferFrom(victim, attacker, balanceOf(victim)) and takes the whole balance. At the moment
of theft you signed and sent nothing - the right had already been granted.
How to stay safe
- Grant the exact amount, not "unlimited". If an app needs to spend 50 USDT, approve 50, not the maximum. Many wallets let you edit the limit right in the confirmation window.
- Read who you are giving access to. In the
approvewindow, look at thespender- the address that will get the right over your tokens. An unknown contract behind a "log in / claim" button is a red flag. - Revoke standing approvals. Periodically review and remove unneeded allowances at revoke.cash - go there through your own verified bookmark, not a link from a search result or a message.
- "Connect / enable / claim" is not always a log in. If such an action actually asks for an
approve, it is a right over your tokens, not a harmless login. An unsolicited "gift" token in your wallet is also bait toward exactly this approve.
It has already happened
On 2 December 2021, BadgerDAO lost about $116-120M. A malicious script was injected into the
site's front-end and fed users an approve / increaseAllowance to the attacker's
address; the attacker then swept balances via transferFrom. Badger's contracts were not hacked
- users granted the authority themselves through the front-end. Microsoft later named this class of attack
"ice phishing".
Want to see the trap live? Our testnet trainer has a "reward site" trap - an approve-drainer trap: you connect a wallet, see what approval it actually asks for, and learn to tell a "log in" from granting rights over your tokens.