Sub topic 8
Wallet drainers, blind signing, and unlimited token approvals
This chapter assumes you know what a wallet and a seed phrase are, and that you have sent tokens on an Ethereum-style network. It builds on the earlier chapters on seed phrases and lookalike domains. Here you will see how a scam can empty a wallet without ever learning the seed phrase, and how to read a signature request before you approve it.
Why a drainer does not need your seed phrase
A wallet drainer is a malicious website or script that asks you to sign a request, then uses that signature to move your assets. The scammer never sees your seed phrase or private key. You hand over permission instead.
The usual path looks like this:
- You reach a fake site, often through a lookalike domain, a malicious search ad, or a fake giveaway link.
- The site asks you to "connect" your wallet. Connecting only shares your public address and is not dangerous by itself.
- The site then asks for a signature or a transaction that you must approve.
- The request grants the scammer's address the right to spend your tokens, or transfers assets directly.
- The scammer's script sweeps your balance, often within minutes.
Because the signature came from your own wallet, the network treats the transfer as valid. Payments are irreversible, so there is nothing to appeal.
Transactions, messages, and approvals
Wallets ask for three kinds of confirmation. They carry different risks.
| Request type | What it does | Typical risk |
|---|---|---|
| Transaction | Changes the blockchain state and costs gas | Direct transfer of funds, or an approval call |
| Token approval | Lets another address spend a specific token from your wallet | Spending can continue long after the page is closed |
| Off-chain message signature | Signs data that costs no gas | Can authorize a spend later, or prove ownership |
The third row catches people out. A signature that costs no gas feels harmless, but some off-chain signatures are valid permissions that someone else submits to the blockchain later. Examples are Permit-style token signatures (EIP-2612 and Permit2) and marketplace order signatures. The scammer pays the gas, so you see no fee and no on-chain record from your side.
How token approvals work
On Ethereum-style networks, tokens such as ERC-20 tokens are managed by a contract. An application cannot pull tokens from your wallet unless you first call approve(spender, amount) on that token contract. The contract records an allowance, which is the amount the spender may move on your behalf.
Legitimate apps need this. A decentralized exchange must be allowed to take the token you are swapping. The danger is in the details:
- Unlimited approvals. Many apps request the maximum value,
2^256 - 1, so you do not have to approve again for each trade. It is convenient, but it means the spender can take your entire balance of that token, now and later. - Spender identity. The approval is only as safe as the spender. If the spender is an attacker's address or a contract that is later compromised, the allowance is a standing risk.
- Persistence. An approval stays active until you change or revoke it. Closing the browser tab does not cancel it.
- Approval-for-all on NFTs.
setApprovalForAlllets an operator move every NFT in a collection from your wallet. Drainers use this heavily.
The following Python sketch shows how to recognize the unlimited value in a raw approval amount:
MAX_UINT256 = 2**256 - 1
def describe_allowance(amount: int, decimals: int = 18) -> str:
if amount == 0:
return "revoked (allowance is zero)"
if amount >= MAX_UINT256 // 2:
return "effectively unlimited: spender can take your whole balance"
return f"limited to {amount / 10**decimals:g} tokens"
print(describe_allowance(0))
print(describe_allowance(MAX_UINT256))
print(describe_allowance(250 * 10**18))The check treats any value above half of the maximum as unlimited, because some apps use values just under the maximum.
Blind signing
Blind signing means approving a request whose contents you cannot read. Your wallet shows an unreadable hex string or a vague label such as "Signature request" or "Contract interaction," and you approve it because the site told you to.
Hardware wallets raise this issue in a sharper form. A hardware wallet protects your key from malware, but it can only protect you from what you understand. If you press the confirm button on data you cannot read, the device signs it faithfully. Many devices disable blind signing by default and require you to turn it on in settings. Treat that setting as a warning light: if an app tells you to enable it, ask why.
Wallets and security extensions try to reduce blind signing by decoding requests into plain language, a feature often called transaction simulation. Simulation shows the expected balance changes before you sign. It helps, but it can be wrong or incomplete, especially for signatures that act later.
Reading a request before you approve it
Before approving, check these items in order.
- The domain. Does the wallet show the exact site you meant to use? Type known addresses yourself or use a bookmark rather than clicking links in ads or messages.
- The request type. Is it a connection, a transaction, a token approval, or a message signature? A "claim" or "verify your wallet" page that asks for an approval is suspicious.
- The spender or recipient. Compare the address to the one the real project publishes. Compare the full string, not only the first and last characters.
- The amount. Does it match what you want to do? Change an unlimited amount to a custom amount if the wallet allows it.
- The balance changes. Does the simulation show assets leaving your wallet when you expect to receive something?
- The reason. Why does a giveaway, airdrop, or "wallet check" need permission to spend your tokens? A real airdrop does not need an approval to deliver tokens to you.
Exercise
A page offering a free token claim asks you to sign a message. Your wallet shows no gas fee and only a block of hex text. A friend says "It's free, so it can't hurt." What is wrong with that reasoning, and what should you do?
Show answer
A gas-free signature can still be a valid permission, such as a Permit-style signature, that the scammer submits on-chain later and pays the gas for. The hex text means you are being asked to blind sign. Reject the request, check the site's domain against the project's official channels, and do not enable blind signing to proceed.
Checking and revoking approvals
You can review what your wallet has approved. Block explorers such as Etherscan offer a token approval checker, and tools such as Revoke.cash list active allowances per network. To revoke, you send a transaction that sets the allowance to zero, which costs gas. Off-chain permit signatures are harder: depending on the standard, they can be invalidated by using up the nonce or by waiting for their expiry, so check what the tool supports.
A routine habit works well:
- Review approvals after using any new decentralized application.
- Revoke allowances to apps you no longer use.
- Set exact amounts for one-off actions where the app allows it.
- Keep the bulk of your holdings in a separate wallet that has never connected to a new site.
Limits of these defenses
- Revoking is not a rescue. If a drainer already has an allowance and is watching, it can sweep your tokens before your revoke transaction confirms. Attackers use bots that react in seconds.
- Approvals are per token and per network. You must check every network you have used.
- Simulation can mislead. A malicious contract can behave differently at signing time than at execution time.
- A compromised real site is still dangerous. Attackers have injected drainer code into legitimate sites. A correct domain lowers the risk but does not remove it.
- Fresh addresses cost gas to clean up. If a wallet is compromised, moving remaining assets to a new wallet with a new seed phrase is usually the safer course, because the old wallet may still carry active permissions.
Exercise
You approved a swap on a decentralized exchange last month with an unlimited allowance for a stablecoin. The exchange is reputable, and you have not used it since. Should you leave the allowance in place? Give two reasons for your answer.
Show answer
Revoke it, or reduce it to zero. First, the allowance persists, so if the exchange's contract or front end is ever compromised, the attacker can spend your entire stablecoin balance. Second, you gain nothing from keeping it: approving again later costs only a small amount of gas, and the cost of a single revoke is usually lower than the risk of a drained balance.
Exercise
Why can a hardware wallet still lead to a drained account?
Show answer
The hardware wallet keeps the private key from being stolen by malware, but it signs whatever you confirm. If you approve a malicious approval or a blind-signed message, the device produces a valid signature and the attacker uses it. The device cannot judge intent. Reading the request and refusing unclear ones is still your job.