Custody & Security in Practice

Approvals, Signatures & How Wallets Get Drained

You can lose every token in your wallet without your seed phrase ever being compromised, because approvals delegate spending authority to contracts, and most people grant them without reading what they authorize.

There are two distinct ways a wallet gets emptied. One is seed phrase compromise: someone gets your words, imports your wallet, and moves everything. The other is approval exploit: you sign a transaction that grants a contract permission to transfer your tokens on your behalf, and then that contract is malicious or gets exploited. Conflating these two leads to bad mental models about how attacks actually happen.

How ERC-20 approvals work

The ERC-20 standard includes an approve function. When you call it, you are telling a token contract: "address X is allowed to transfer up to Y of my tokens." Decentralized exchanges need this because the exchange contract must pull tokens from you to execute a swap. The approval is recorded in the token contract's state, not in your wallet. It persists until explicitly revoked, regardless of whether you disconnect the site, clear your browser, or even change wallets.

  1. You approve a contracton-chain allowance set; often unlimited
  2. Approval sits dormantyou forget about it; months pass
  3. Contract is exploitedattacker calls transferFrom with your allowance
  4. Tokens drainedyour seed is untouched; your tokens are gone

Unlimited vs exact approvals

Uniswap and most major DEX frontends default to requesting unlimited approval so you only pay the approval gas cost once. Exact approvals cost gas every transaction but cap the exposure to exactly what you are swapping now. Neither approach is obviously correct for everyone, but you should know which you are granting. Many users have approved unlimited USDC or WETH to contracts years ago and have no idea the allowance still exists.

Signing a message is not always harmless. Some message-signing standards (Permit, EIP-2612) encode an approval into the signed data itself, granting a contract spending authority with no separate transaction. These can be phished without you ever clicking "approve" in the traditional sense.

Drainer mechanics

Modern wallet drainers typically use one of two flows. First, they convince you to sign a Permit message (no gas, looks like a simple "verify wallet" step), which encodes a token approval the attacker can submit. Second, they direct you to a contract interaction that calls approve with an unlimited amount to an attacker address. The frontend is disguised as a reputable project, often via a hacked or spoofed Twitter account or a Google ad.

  • Verify the contract address of anything you interact with against the official documentation, not the URL alone.
  • Read what your wallet prompts you to sign. "Set Approval For All" on an NFT contract grants permission over every NFT in the collection.
  • Use Revoke.cash, Etherscan's Token Approvals tab, or the equivalent on other chains to audit and remove approvals you no longer need.
  • Consider keeping high-value assets in a separate wallet that never interacts with DeFi.
Revoking approvals costs gas but is a normal maintenance task. Review and clean up allowances after any protocol exploit in a category you use, even if you were not directly affected.

>$100M

estimated losses to approval-based drainers and phishing in 2023 alone, per on-chain analytics firms

Key takeaways

1Seed phrase compromise and approval exploit are two distinct attack vectors with different defenses.
2ERC-20 approvals persist on-chain until explicitly revoked, they are not cleared by disconnecting a site.
3Unlimited approvals minimize gas costs but maximize exposure if a protocol is exploited later.
4Permit and EIP-2612 signatures encode approvals invisibly, making them effective phishing tools.
5Regularly auditing and revoking unnecessary approvals is a concrete, actionable security practice.

Educational content only, not financial advice. Trading and investing carry real risk of loss, including your entire capital. Do your own research and consult a licensed professional before making financial decisions.

This is one lesson of 541.

The whole Foundation is free — 16 subjects, beginner to advanced. Sign in to track what you have read, take the end-of-module quizzes, and use the terminal.