Toutes les vulnérabilités
HIGHWeb3exploited in the wild

WEB3-APPROVAL-PHISHING-2023

Web3 · Ethereum · Unlimited ERC-20 approvals and ERC-721/1155 setApprovalForAll phishing

Résumé

On-chain approval phishing remains a core drainer technique within the hundreds of millions stolen annually (Scam Sniffer attributed $295M in 2023 and $494M in 2024 to wallet drainers), abusing the standard ERC-20 approve and ERC-721/1155 setApprovalForAll authorization model. A malicious dApp prompts the victim to send a real on-chain transaction calling approve(spender, type(uint256).max) for a token, or setApprovalForAll(operator, true) (selector 0xa22cb465) for an NFT collection, designating the attacker contract as spender or operator. Wallets historically rendered these as a generic approve with no amount or as an unreadable contract interaction, so the victim confirms a high-value, broad authorization without understanding its scope. Once the allowance or operator flag is set, the attacker's contract calls transferFrom or safeTransferFrom at any later time to drain every token or NFT covered, with no further victim interaction. The approval persists indefinitely until revoked, so victims who signed months earlier remain exploitable.

Comment l’éviter dans votre code

  • Wallets must show the exact token, amount, and spender for approve, and explicitly flag setApprovalForAll as granting control over an entire NFT collection.
  • dApps should request least-privilege exact-amount approvals per transaction rather than type(uint256).max blanket allowances.
  • Users should treat any setApprovalForAll request from a fresh or unverified contract as a drainer and reject it.
  • Users should audit and revoke stale or unlimited approvals regularly with revoke.cash or a block explorer's token-approval checker.
  • Builders should integrate approval-risk scanning (Blockaid) that warns when the spender is unverified or recently deployed.

Références

Vulnérabilités liées

Tout Web3 →