Home

Security › Phishing & Wallet Drainers

Wallet Drainer Scripts Explained

Spot the edge. Swoop in.

A wallet drainer is the piece of tooling that turns a single bad signature into a total loss. Where a phishing message only sets up the click, a drainer script is the automated machinery that fires the moment a victim signs an approval or permit request, identifying every valuable token, NFT, and coin in the connected wallet and sweeping it out in a rapid sequence of transactions — often within seconds. This guide breaks down how drainer kits work under the hood, why they're built to move faster than a human can react, and a worked example showing exactly where the technical mechanism does its damage.

By Swoopr Editorial Team

Published · Updated

AI-assisted content · Swoopr is responsible for the final published article.

Key Takeaways

A wallet drainer is pre-built malicious software, frequently rented out as "drainer-as-a-service" to attackers who couldn't otherwise write the code themselves, that automates the theft stage of an attack. It doesn't compromise a wallet's private keys or seed phrase; it relies entirely on a victim's own valid signature, obtained either through a malicious token approval or a gas-free off-chain permit request, and then executes the transfer on-chain whenever the attacker chooses. Speed is the drainer's defining advantage — automated sweeper bots frequently execute within seconds of a valuable deposit or a fresh approval, which is faster than most victims can notice the activity, open a revocation tool, and submit a competing transaction. Understanding the mechanism shifts the realistic point of defense from "stopping the drain in progress," which is rarely possible, to "never signing the request that triggers it" in the first place.

Direct answer: A wallet drainer is a malicious smart contract and script kit that automatically identifies and sweeps every valuable asset from a wallet once the victim signs a malicious approval or permit request, often executing within seconds via an automated sweeper bot that also front-runs any rescue attempt. It works entirely through signatures the victim provides themselves — no seed phrase or private key theft is required.

What Is a Wallet Drainer?

In plain terms, a wallet drainer is a piece of pre-built malicious tooling — a smart contract paired with a front-end script — designed to automate the process of stealing everything of value from a connected wallet the moment the right signature is obtained. It's not a bespoke tool an attacker writes from scratch for each victim. A thriving underground market sells drainer kits as "drainer-as-a-service," complete with customizable fake-mint or fake-claim front ends, a dashboard for tracking victims, and a revenue-share arrangement where the kit's developer takes a cut of everything the affiliate attacker steals. This commoditization is a large part of why drainer-based theft has scaled: an attacker with no smart-contract development skill can rent a working drainer, point it at a convincing fake website, and start collecting stolen assets within a day.

Once deployed, a drainer's contract typically performs three functions. It presents the victim with a transaction or signature request disguised as something routine — a "mint," a "claim," or a "verification" step. Once signed, it scans the connected wallet's holdings, checking token balances, NFT ownership, and native coin balance against the specific permission it was just granted. It then executes the transfer, or a sequence of transfers, moving as much value as the granted permission allows to an address the attacker controls, frequently routing through several intermediate wallets afterward to complicate tracing.

Drainer-as-a-service

The "as-a-service" model matters because it changes the economics of the threat. A single well-maintained drainer kit, sold or rented to hundreds of separate affiliate attackers, can appear behind an enormous number of unrelated-looking fake websites: a fake NFT mint here, a fake airdrop claim there, a fake wallet-connect prompt on a cloned DeFi front end elsewhere. The underlying contract logic, and often the wallet-scanning and asset-prioritization code, is frequently shared or lightly modified across many of these fronts, even though each looks like an independent scam to a victim encountering just one of them.

Common mistake

The common mistake is picturing a drainer as some kind of exotic hacking tool that breaks into a wallet. It doesn't. A drainer has no ability to bypass a wallet's cryptography or extract a private key; every drainer depends entirely on the victim voluntarily producing a valid signature. The "attack" is convincing someone to sign something they shouldn't, not defeating any technical security measure.

How the Technical Mechanism Works

Every drainer's theft ultimately traces back to one of two signature types, both of which the victim provides through their own wallet software.

Malicious token approvals

The first path is a standard on-chain approve transaction. Token standards like ERC-20 and ERC-721 include a built-in mechanism for a holder to grant a smart contract or address permission to move a specific token on their behalf, up to a specified amount, without asking again for every future transfer. This exists for legitimate reasons — a decentralized exchange needs approval to swap a token on a user's behalf — but a drainer's fake "mint," "claim," or "verify" button routes to the exact same function, requesting an allowance over a token the victim holds, frequently with no upper limit at all. Because this is an on-chain transaction, it costs gas, which gives an attentive victim at least one moment of friction to notice something is off.

Permit and setApprovalForAll signatures

The second, more dangerous path skips gas entirely. Newer token standards support permit (an off-chain signed message that grants an allowance without an on-chain transaction) and setApprovalForAll (which, particularly for NFT collections, grants blanket approval over an entire collection rather than a single token). Both are simply signed — no transaction fee, no gas prompt, and often a faster, simpler confirmation flow in the wallet's UI. That absence of a fee is precisely why these requests are so effective for an attacker: victims have learned, correctly in most contexts, to treat a paid transaction with more scrutiny than a "free" signature, so a permit request slips past the exact instinct that might have stopped an approve transaction. The attacker's script holds onto that signed permit and executes the actual transfer whenever it chooses, sometimes immediately and sometimes after a delay designed to avoid looking connected to the site the victim just visited.

Executing the sweep

Once either signature exists, the drainer's back-end script (or, increasingly, its own on-chain sweeper contract) checks the wallet's full holdings against the permission it now has and executes transfers for everything it's authorized to move — a specific token if the approval was narrow, or potentially an entire NFT collection and multiple token balances if the signature was a broader setApprovalForAll or an unlimited approve. Sophisticated kits also prioritize: they often value NFTs and tokens using real-time price feeds so the sweep grabs the highest-value assets first if gas conditions force the attacker to be selective, or if a rescue attempt is racing to save what it can.

Practical checklist

Why Drainers Prioritize Speed

A drainer that waited days to execute a granted approval would give victims far more opportunity to notice and revoke it, so the more capable kits are built to act as quickly as possible after the signature lands. Two mechanisms drive that speed.

Mempool-monitoring sweeper bots

Many drainer operations run automated sweeper bots that continuously watch the mempool — the pool of pending, not-yet-confirmed transactions broadcast to the network — for two triggers: a fresh approval or permit signature being submitted, and any subsequent deposit of value into a wallet that already holds a live, unrevoked approval from an earlier compromise. The moment either trigger fires, the bot submits its own transaction to execute the transfer, frequently within seconds. This is why a drainer attack can feel instantaneous: the human decision to sign happened once, but the theft executes on a machine's timescale, not the victim's.

Out-competing rescue attempts

Speed matters even after a victim notices something is wrong. If a victim spots the malicious approval and tries to send a rescue transaction — revoking the allowance, or moving remaining assets to a safe wallet before the drainer sweeps them — that rescue transaction has to be mined before the attacker's sweep transaction. Because both transactions are competing for the same block space, miners and validators generally prioritize whichever transaction offers the higher gas fee. Sophisticated drainer bots are built to detect a competing transaction from the same wallet and automatically resubmit their own sweep with a higher gas fee, effectively winning a bidding war the victim didn't know they'd entered. This is one of the more counterintuitive and dangerous aspects of drainer mechanics: even correctly diagnosing the problem in real time frequently isn't enough to stop it.

Common mistake

The common mistake is assuming that noticing suspicious wallet activity gives you a meaningful window to react. In practice, by the time unusual activity is visible — a token balance suddenly at zero, or a pending outgoing transaction you didn't initiate — the drain is very often already confirmed or is one out-bid rescue attempt away from being confirmed. The realistic defense is stopping the signature before it happens, not out-racing the bot afterward.

Worked Example: The Fake Mint Site

Realistic scenario — for education only.

Assume a Swoopr reader sees a post in a crypto Twitter/X thread announcing a surprise free mint for a trending NFT collection, with a link to what looks like the project's official minting page and a countdown clock showing the mint closing in twenty minutes.

Step 1 — The fake mint site. The reader clicks through to a site that closely mirrors the real project's branding, layout, and even its Discord and Twitter links in the footer, which point to the genuine community channels to add credibility. Only the mint page itself, and the contract it calls, are attacker-controlled. A drainer kit's front end is specifically designed to be dropped onto a template like this quickly, which is part of why fake mint sites can appear and disappear within hours.

Step 2 — Wallet connect. The reader clicks "Connect Wallet," and their wallet extension opens a standard connection request, which by itself grants no spending permission at all — connecting a wallet only shares a public address and requests future transaction approval, so this step alone causes no harm. It does, however, let the drainer's script read the wallet's public holdings, which many kits use to decide what to target next and to select the specific approval request that will capture the most value.

Step 3 — "Sign to mint." The site presents a button labeled "Sign to Mint" and, when clicked, opens the wallet's signature prompt. In a wallet that shows only a generic "Signature Request" summary or a block of raw hexadecimal data, this looks like exactly what a mint transaction should look like — there is no fee, no visible dollar amount, and no obvious red flag, because it is not, technically, a mint at all. It is a permit message granting the drainer's contract an allowance over the reader's highest-value token holding, identified during the wallet-read in Step 2. Because it costs no gas, it feels lower-stakes than the paid transaction the reader was actually expecting for a real mint, and that mismatch — expecting to pay for a mint, instead being asked only to "sign" — is itself a warning sign a careful reader could have caught.

Step 4 — The sweep. The reader signs, expecting a new NFT to appear in their wallet. Nothing mints. Within seconds, a sweeper bot monitoring the drainer's contract detects the newly signed permit, submits a transfer transaction pulling the full allowance, and confirms it on-chain. The reader's highest-value token balance is now at the attacker's address, typically forwarded on again through one or more additional wallets within minutes. No further signature or click was required from the reader after Step 3 — the entire theft happened automatically, off-screen, using only the one signature already given.

What should have happened instead. The clearest stop point was Step 3: a wallet capable of decoding and previewing the request would have shown a token allowance grant rather than a mint confirmation, or a transaction-simulation tool would have flagged that the "mint" produces no NFT and instead moves an existing token balance. The mismatch between "this is supposed to cost gas and produce an NFT" and "this costs nothing and grants a permission" was the tell, and it was available before signing, not after.

Why Wallet UIs Make This Hard to Catch

A meaningful share of the reason drainer scripts work as well as they do isn't purely psychological — it's a genuine, historical usability gap in how wallet software presented signature requests. For years, many wallet extensions displayed a permit or setApprovalForAll signature request with a generic heading like "Signature Request," followed by a block of raw hexadecimal data or a technical JSON structure that meant nothing to a non-technical user. There was no plain-language sentence explaining "this grants [contract address] unlimited permission to move your USDC," just an opaque blob a user was expected to either trust or reject with no real information to decide on.

That gap has narrowed. Several modern wallets now include transaction and signature simulation, decoding what a pending request actually does and surfacing a plain-language warning when it detects an unusually broad approval, a request to a contract with no verified history, or a mismatch between what a site claims a button does and what the request actually authorizes. Browser extensions dedicated to this purpose have also become more common, layering an additional simulation and warning pass on top of whatever the wallet itself shows.

Why simulation isn't a complete fix

Even with simulation available, three gaps remain. First, not every wallet a user might have installed includes it, and older or less actively maintained wallet software may still show only the raw request. Second, simulation tools rely on recognizing patterns in known malicious contracts and behaviors; a newly deployed drainer contract that hasn't been flagged yet can slip past a warning system built on prior examples. Third, and most importantly, a warning only works if the user reads it and stops — a flashing caution banner that a rushed, urgency-primed victim dismisses without reading provides no more protection than no warning at all. The technology has genuinely improved; it has not removed the need for the user to actually read what they're signing.

Practical checklist

Misconceptions Versus Reality

MisconceptionReality
I'll notice if my wallet is being drained and can stop itAutomated drainer scripts and sweeper bots frequently execute within seconds of a triggering approval or deposit, which is faster than a human can notice, diagnose, and react to unusual wallet activity
A drainer needs my seed phrase or private key to steal my fundsDrainers work entirely through a signature the victim provides voluntarily — a malicious approval or permit — and never need or request a seed phrase or private key
Free signature requests are lower risk than paid transactionsOff-chain permit and setApprovalForAll signatures cost no gas but can grant the exact same unlimited, standing control as a paid on-chain approval, and are used specifically because the lack of a fee lowers a victim's guard
If I catch the theft in progress, I can send a rescue transaction to save my fundsSophisticated sweeper bots monitor for competing transactions from the same wallet and automatically resubmit with a higher gas fee, frequently out-bidding and out-racing a victim's own rescue attempt
Drainer kits are custom-built for each attack, so they're rareDrainer-as-a-service kits are rented or sold on criminal forums to many affiliate attackers at once, powering a large volume of unrelated-looking fake sites from shared or lightly modified underlying code

Risks, Limitations, and Exceptions

Prevention Checklist

Because a drain typically executes automatically and within seconds of the triggering signature, every effective precaution here happens before signing, not after.

Practical checklist

Common mistake

The common mistake is treating a fast, simple signing flow as a sign of a well-designed, trustworthy site, when in fact a frictionless "just sign to continue" flow is exactly what a drainer's front end is built to produce. A legitimate mint or claim that genuinely requires only a signature and no fee is uncommon enough that its absence of friction should raise suspicion, not lower it.

Frequently Asked Questions

What exactly is a wallet drainer?

A wallet drainer is a pre-built malicious smart contract and front-end script kit, often sold on criminal forums as "drainer-as-a-service," that automates the theft of tokens, NFTs, and native coins from a wallet once a victim signs a malicious transaction or off-chain message. Instead of an attacker manually moving each asset, the drainer's code scans the connected wallet, identifies everything of value, and sweeps it in a single pass or a rapid sequence of transactions.

How does a drainer actually get access to a wallet's funds?

A drainer never bypasses a wallet's security directly. It relies on the victim signing either a malicious approve transaction, which grants a specific token allowance to the drainer's contract, or a broader off-chain permit or setApprovalForAll signature, which grants the same kind of standing spending rights without costing any gas to sign. The attacker's script then executes the actual transfer on-chain whenever it chooses.

Why are permit and setApprovalForAll signatures more dangerous than a normal approval?

A permit or setApprovalForAll request is signed off-chain and costs no gas, which removes one of the strongest instinctive warning signals a victim would otherwise notice: a fee. Because it feels lower-stakes than a paid transaction, victims are more likely to sign it quickly without reading what it actually authorizes, even though it can grant the same unlimited, ongoing control over a token or an entire NFT collection.

Why do drainers act so fast after a wallet is compromised?

Many drainer kits run automated sweeper bots that watch the mempool and a victim's on-chain activity continuously, and execute the drain within seconds of a valuable deposit landing in the wallet or an approval being granted. Acting immediately reduces the chance the victim notices and revokes the approval first, and sweeper bots frequently outbid a victim's own rescue transaction with a higher gas fee to guarantee their transaction confirms first.

Can I notice and stop a drain once it starts?

In most cases, no. Automated drainer scripts are built to execute within seconds of detecting an opportunity, which is faster than a human can notice unusual wallet activity, open a revocation tool, and submit a competing transaction. The realistic point of prevention is before signing the approval or permit, not after the drainer's bot has already been triggered.

Do better wallets protect against drainers automatically?

Modern wallets increasingly include transaction simulation and plain-language warnings that flag an unusually broad approval or a request that doesn't match what a site claims it's doing, which helps. But simulation tools are not universal, can be bypassed by newly deployed contracts they haven't seen before, and still require the user to read and act on the warning rather than dismiss it, so they reduce risk without eliminating it.

Which Swoopr resource explains the broader phishing attack that leads to a drainer being triggered?

See How Crypto Phishing Attacks Work, which covers the full five-stage lifecycle — reconnaissance, lure, delivery, fake destination, and payoff — that a wallet-drainer script is typically the final, automated stage of.

Sources and Methodology

This guide describes the general technical structure of wallet-drainer kits based on publicly available blockchain security research as of mid-2026. Key sources include:

The worked example in this guide is a hypothetical, illustrative scenario constructed for educational purposes and does not describe a specific real incident, contract, or website.

This content was reviewed by the Swoopr Editorial Team in August 2026 and reflects publicly available information at that time. Drainer techniques evolve quickly; treat this guide as a structural framework rather than an exhaustive or permanently current list of tactics.

Conclusion

A wallet drainer is automated theft tooling, not a mysterious hack — it works entirely through a signature the victim provides, whether a malicious token approval or a gas-free permit request, and then executes the sweep automatically, often within seconds, via a bot that can also out-bid a victim's own rescue attempt. Because the theft itself happens too fast to interrupt in most cases, the only reliable defense is refusing the signature that triggers it: reading what an approval or permit actually grants, treating "free" signature requests with the same scrutiny as paid transactions, and using wallet or extension tooling that simulates the outcome before you sign. Use this page alongside the phishing lifecycle guide below to understand both how a victim is led to a drainer's fake front end and what the drainer does once they arrive.

Related Reading