The September 2024 wave of crypto hacks, which saw over $120 million stolen across more than 20 incidents, has drawn attention to an often-overlooked attack vector: token approval vulnerabilities. When you interact with a decentralized application, you grant smart contracts permission to spend tokens from your wallet. These approvals persist indefinitely unless explicitly revoked, creating a growing attack surface that sophisticated exploiters actively probe. This advanced tutorial walks through the process of auditing and revoking these hidden permissions.
The Objective
Every time you swap tokens on a decentralized exchange, provide liquidity to a lending protocol, or stake assets in a yield farm, you execute an ERC-20 approve transaction. This transaction grants a specific smart contract address the right to transfer up to a specified amount of your tokens. In many cases, protocols request unlimited approvals for convenience, meaning the approved contract can theoretically drain your entire balance of that token at any time.
The security implications are severe. If an approved contract is later compromised through a smart contract vulnerability, an attacker gains the ability to execute the transferFrom function and drain tokens from every wallet that has granted approval. This is not theoretical: multiple major DeFi exploits have involved attackers leveraging existing token approvals to drain user wallets after compromising the approved contract.
The objective of this tutorial is to teach you how to identify all token approvals associated with your wallet addresses, assess the risk level of each approval, and revoke those that are no longer necessary or that pose unacceptable risk.
Prerequisites
Before beginning the audit process, you will need access to a few tools. First, you need the wallet addresses you want to audit. If you use multiple wallets for different DeFi activities, each address needs to be checked independently. Second, you need access to a blockchain explorer that supports token approval tracking. Etherscan, BscScan, and Polygonscan all include approval tracking features in their token dropdown menus.
For a more streamlined experience, dedicated token approval management tools like Revoke.cash and Approve.wtf provide aggregated views across multiple chains. These tools read approval data directly from the blockchain and present it in a user-friendly format that shows the approved contract, the token, the approved amount, and the risk level.
You will also need a Web3 wallet, such as MetaMask or Rabby, connected to the relevant blockchain networks. Revoking approvals requires an on-chain transaction for each approval, so you will need a small amount of the native token, such as ETH, BNB, or MATIC, to pay gas fees for the revocation transactions.
Step-by-Step Walkthrough
Step 1: Export your complete approval history. Navigate to Revoke.cash and connect your wallet. The tool automatically detects the connected network and displays all active token approvals for the connected address. Switch between networks using the network selector to audit approvals across Ethereum, Binance Smart Chain, Polygon, Arbitrum, Optimism, Avalanche, and other supported networks. For each network, the tool shows the approved spender address, the token contract, the approved amount, and the current value at risk.
Step 2: Categorize approvals by risk level. Not all approvals carry equal risk. High-risk approvals include those granted to unaudited or recently deployed contracts, protocols that have been exploited in the past, contracts with unlimited approval amounts, and DeFi protocols you are no longer actively using. Medium-risk approvals include those for established protocols with active security monitoring, such as Uniswap or Aave, where you still maintain active positions. Low-risk approvals include those for well-established protocols with limited amounts.
Step 3: Prioritize revocations for inactive protocols. Any approval granted to a protocol you are no longer using should be revoked immediately. These approvals provide no benefit but expose you to the full risk of a potential future exploit. Common examples include old yield farming contracts, deprecated protocol versions, test deployments, and abandoned DeFi platforms.
Step 4: Replace unlimited approvals with exact amount approvals. For active protocol interactions, consider whether you can replace unlimited token approvals with approvals for the exact amount needed for your transaction. Many modern DEX interfaces offer this option in their settings. While this requires a new approval transaction for each operation, it dramatically limits your exposure if the protocol is later compromised.
Step 5: Establish a regular approval audit schedule. Make token approval auditing a routine part of your DeFi hygiene. A monthly audit takes approximately 10 to 15 minutes per wallet and can prevent catastrophic losses. Set a calendar reminder and treat it with the same importance as reviewing your traditional financial accounts.
Troubleshooting
If Revoke.cash or similar tools fail to load your approvals, this may indicate an RPC provider issue or network congestion. Try switching to a different RPC endpoint in your wallet settings, or wait a few minutes and refresh the page. You can also use the native approval tracking features on block explorers like Etherscan as a backup.
Some revocation transactions may fail with an “execution reverted” error. This typically occurs when the approved contract has a non-standard approve function or has been self-destructed. In these cases, you can usually still revoke the approval by calling the token contract’s approve function directly through Etherscan’s “Write Contract” interface, setting the spender address and amount to zero.
If you discover approvals to contracts you do not recognize, do not interact with those contracts directly. The approval may have been granted as part of a phishing attack or malicious airdrop campaign. Revoke the approval using the methods described above without visiting the contract’s associated website or clicking any links in related transactions.
Mastering the Skill
Advanced practitioners can take token approval management further by using smart contract wallet solutions like Gnosis Safe, which provide granular permission controls and multi-signature requirements for token transfers. These wallets allow you to set spending limits per contract, require multiple approvals for large transfers, and implement time-locked execution delays that provide a window to cancel suspicious transactions.
For developers, building custom monitoring tools that track approval changes in real time provides the highest level of security awareness. By subscribing to approval events on commonly used token contracts, you can receive immediate notifications when new approvals are granted to your addresses, enabling rapid response to any unauthorized or suspicious approval transactions.
The cryptocurrency ecosystem lost over $120 million to hacks in September 2024 alone, and token approval exploits contributed to a significant portion of individual user losses. With Bitcoin trading near $63,395 and Ethereum at $2,616, the financial value protected by proper approval management has never been higher. Mastering this skill is not optional for anyone actively participating in DeFi.
Disclaimer: This article is for educational purposes only and does not constitute financial or security advice. Always conduct your own research and consider consulting a qualified security professional before making decisions about cryptocurrency security.
unlimited token approvals are a ticking time bomb. check your wallet on revoke.cash right now, i guarantee youll find stuff you forgot about
went through my approvals on revoke.cash last month and found 47 active unlimited approvals. 47. had not touched half those protocols in over a year
47 unlimited approvals is actually low. checked mine after the $120M september wave and had 83. been in defi since 2020 tho
this is the kind of security hygiene nobody teaches you when you start in crypto. learned the hard way after a rogue contract drained my USDC
the problem is UX. protocols ask for unlimited approvals because limited ones break the user experience with extra popups. tradeoff between convenience and safety
metamask could default to exact amount approvals and 99% of users would not notice the difference. the unlimited default is a design choice, not a technical requirement
exact amount should be the default and unlimited should require an extra click. flipped incentive would fix 90% of this