Smart contracts are the trust layer of DeFi. They also turn out to be one of the more reliable ways to get drained. Unlike centralized platforms, there is no appeal, no customer support, and no regulator empowered to freeze funds. The contract executes exactly what its code says, and if the code says "transfer all tokens to the deployer," the transfer happens.
Malicious contracts fall into several recognizable families. Most victims lose funds to contracts they did not inspect — not to novel zero-day exploits. The defense is less about becoming a Solidity auditor and more about recognizing the patterns and refusing to interact with anything that matches them.
Honeypot Tokens
Honeypots are the simplest malicious contract pattern. A new token is created with buy-enabled, sell-disabled logic. Early buyers see paper gains as the "price" pumps, but when they try to sell, the transaction fails with opaque errors.
Variants include:
- Transfer blocks based on allowlist. Only the deployer or a short list of addresses can sell.
- Dynamic sell taxes. The sell tax rises to 100% after a buyer acquires a certain amount.
- Blacklist-on-sell. The first sell attempt adds the seller to a blacklist that blocks future transfers.
- Balance manipulation. The contract internally tracks a "phantom" balance that differs from what the UI shows, so sells always fail due to insufficient balance.
Honeypot detection tools like Honeypot.is can simulate a buy+sell cycle and flag tokens where the sell fails. These tools are imperfect — a well-crafted honeypot only activates its block after specific conditions — but they catch the majority of crude attempts.
Rug-Ready Tokens
A honeypot that takes off is a rug pull. A rug-ready contract has specific features that enable the deployer to extract all liquidity quickly:
- Mint function accessible to the owner. The owner can inflate supply, dump on the LP, and drain the pool.
- Unlocked liquidity. LP tokens are held by the deployer rather than time-locked, letting them pull liquidity at any moment.
- Owner privileges to pause transfers. Often phrased innocuously as "emergency pause" but used to freeze holders while the deployer exits.
- Hidden fee redirect. A transfer fee that routes to the deployer's address, accumulating value as normal trading happens.
A legitimate project locks its liquidity for 1–2 years in a provable contract (Unicrypt, TeamFinance), renounces or timelocks ownership, and publishes verified contract source. Anything less is rug-ready.
Drainer Contracts
A drainer is a contract specifically designed to extract assets from wallets that have approved it. They are the backend for approval phishing attacks. The pattern is consistent:
- The contract accepts approvals for a wide range of tokens.
- A "sweep" function, callable only by the operator, moves the highest-value approved tokens out of victim wallets and into the operator's wallet.
- The sweep function is often obfuscated as a different function —
claim,airdrop, ordistribute. - Drainer-as-a-service kits are sold on private forums and support multiple chains simultaneously.
Drainers themselves are invisible on-chain until they execute. The attack vector is the approval, not the contract. See our approval phishing walkthrough for the full mechanic.
Upgradeable Proxy Traps
A proxy contract forwards calls to an implementation contract. The implementation can be changed by the owner. This is the standard pattern for upgradeable DeFi protocols, and it is legitimate when properly governed.
It becomes malicious when:
- The owner is a single EOA (externally owned account) with no multi-sig or timelock.
- The upgrade function can be called instantly, with no delay.
- The project takes user deposits under one set of rules, then upgrades to a different implementation that allows the owner to withdraw the pool.
What to Check on Etherscan
On a proxy contract, look for the "Read as Proxy" and "Write as Proxy" tabs. Check the "admin" or "owner" address. If it is a single EOA with recent activity, treat any deposit into that contract as untrusted. A legitimate proxy should point to a multi-sig with a timelock of at least 24–48 hours on upgrades.
Malicious NFT Airdrops
Attackers mint NFTs and airdrop them to wallets with high recent activity. The NFT itself is harmless to receive, but:
- The NFT's metadata points to a phishing site claiming to offer a claim or sale.
- Attempting to list the NFT on OpenSea or similar sometimes triggers an approval request for the marketplace to transfer all tokens.
- Some malicious NFT contracts have custom
transferFromlogic that runs additional code during any interaction.
Defense: Do not interact with unexpected NFTs. Hide them, do not list them, do not click any URL derived from them.
Reentrancy and Protocol-Level Exploits
This is the category that generates headlines — an attacker exploits a vulnerability in a legitimate protocol's code to extract funds that do not belong to them. The famous examples (Ronin, Wormhole, Euler, Curve) all belong here. These are not malicious-by-design contracts but exploitable ones.
Individual users rarely lose funds to these events directly — the loss usually hits the protocol's treasury or pool. But users in the affected pool at the time of the exploit do lose their deposits. Defense at the user level is portfolio-level: limit exposure to any single protocol, prefer audited and time-tested contracts, and watch for governance changes that introduce new attack surfaces.
How to Evaluate a Contract Before Interacting
A practical checklist for any new DeFi protocol or token before you deposit meaningful value:
- Verified source on Etherscan. If the contract is unverified, do not interact. You cannot audit what you cannot read.
- Age. Contracts deployed in the last 30 days carry much higher risk than those running for a year or more with no incidents.
- Ownership. Who can call admin functions? Is it a multi-sig? Is there a timelock?
- Audit status. Has a reputable firm (OpenZeppelin, Trail of Bits, ConsenSys Diligence, etc.) audited the code? Read the audit — don't just trust the logo.
- Upgrade mechanics. Can the contract be changed? Under what conditions?
- Approval scope. If you need to approve a token, approve only the amount you plan to use, not unlimited.
- Withdraw test. Deposit a small amount, withdraw it, confirm the full round-trip works before depositing more.
If You Deposited Into a Malicious Contract
If you discover you have funds stuck in a contract that has turned malicious or that has rug-pulled:
- Revoke any approvals granted to the contract immediately via revoke.cash.
- Check whether the stolen funds can be traced to a regulated exchange.
- Document the deposit transactions, the contract address, and any communication from the project.
- File IC3 and consider joining any class action being organized by affected users.
- Engage forensic trace and civil counsel if the loss justifies the cost.
Recovery is harder for smart-contract losses than for phishing losses because there is often no individual attacker to target — just an anonymous deployer who has already laundered the funds. But if the deployer left any identifying trail (a deposit to a KYC exchange, an ENS registration, a social media footprint), that trail can still lead to recovery. See how tainted cryptocurrency works and when recovery is realistic.