EIP-7702 Sweeper Bot Attacks Explained

EIP-7702 Sweeper Bot Attacks: How Compromised Wallets Get Drained the Instant Gas Arrives
- The arrival of Ethereum’s Pectra hard fork represents one of the most critical turning points in the history of decentralized account architecture. At the center of this programmatic leap is EIP-7702, a proposal designed to solve the long-standing friction between Externally Owned Accounts (EOAs), the standard private-key-controlled wallets used by the vast majority of retail users, and Smart Contract Accounts (CAs).Â
- By allowing a standard EOA to temporarily or persistently adopt the behaviors of a smart contract wallet, EIP-7702 brings advanced utility, such as transaction batching, gas sponsorship, and custom recovery logic, directly to the existing wallet landscape.
- Yet, in the adversarial ecosystem of public blockchains, every technological advancement inevitably expands the playground for malicious actors. While Web3 developers celebrate the democratization of account abstraction, black-hat security circles have quietly adapted. The integration of EIP-7702 has armed scammers with a highly dangerous tool: the sponsor-funded sweeper bot.
- Historically, a wallet whose private keys were leaked stood a fighting chance of recovery if it contained no native gas token (such as ETH). Security teams could coordinate private transaction rescues before a hacker’s automated monitoring script could frontrun the deposit of gas fees. Under EIP-7702, this entire defensive framework has been completely dismantled.

1. The Genesis: Bridging the EOA-Smart Account Divide
- To understand why EIP-7702 represents such a massive shift in sweeper bot mechanics, we must first trace the evolutionary pipeline of account abstraction. For years, the Ethereum community has grappled with the limitations of standard EOAs. An EOA is a monolithic entity: it relies strictly on an Elliptic Curve Digital Signature Algorithm (ECDSA) key pair to authorize transactions. This architecture introduces substantial friction, particularly the gas bootstrapping problem, single-signature fragility, and the lack of atomic batching.
- A brand-new EOA cannot execute any action on-chain until it has been funded with native gas tokens, creating a severe onboarding hurdle. Additionally, if the private key of an EOA is lost or stolen, the account is permanently compromised; there is no native recovery mechanism or multisig option without moving the funds to a separate contract. Furthermore, executing a basic decentralized exchange (DeFi) swap requires two distinct, sequential transactions: an initial ERC-20 approval transaction followed by the actual swap execution. This costs extra gas and degrades the user experience.
The Road to Account Abstraction
- The first major structural attempt to address these limitations was ERC-4337. This standard introduced a completely separate off-chain transaction mempool where users could submit user operations to decentralized bundlers. These bundlers would package multiple operations into a single standard Ethereum transaction, routing them through a central EntryPoint contract to execute smart contract wallet logic.
- While ERC-4337 succeeded in proving the viability of account abstraction, it suffered from two key limitations: it required users to migrate their assets entirely from their existing EOAs to brand-new smart contract accounts, and it introduced higher gas costs due to the complex smart contract execution layers.
- To bypass the migration hurdle, developers proposed EIP-3074. This proposal introduced two new EVM opcodes that allowed an EOA to delegate its authority to an external invoker contract, enabling the invoker to perform transactions on behalf of the EOA. However, security auditors quickly flagged severe vulnerabilities: a single compromised or malicious invoker contract could gain unlimited, permanent control over any EOA that authorized it, opening up a devastating vector for phishing attacks.
The Ultimate Compromise
- In response to these security concerns, Vitalik Buterin formulated EIP-7702. Rather than introducing raw, low-level delegation opcodes, EIP-7702 introduces a specialized transaction type that allows an EOA to temporarily or persistently set its own code slot to point to an external contract. When an EIP-7702 transaction is executed, the EOA specifies an authorization list.
- For each entry in this list, the EVM temporarily writes a delegation designation prefix directly into the EOA's code slot. This designation tells the EVM to route all subsequent contract calls targeting that EOA directly to the implementation logic of the specified delegate contract. This mechanism allows standard EOAs to instantly inherit the full capabilities of smart accounts (including gas sponsorship, multi-sig controls, and transaction batching) while maintaining full backward compatibility and leaving a clear path to revert the delegation by pointing the account back to the null address.
2. The Old Paradigm: How Classic Sweeper Bots Operated
- To fully appreciate how EIP-7702 has optimized the efficiency of malicious sweeper bots, we must analyze the structural limitations of the pre-Pectra sweeper bot landscape. Historically, when a user's private key or recovery seed phrase was compromised, the attacker immediately deployed a sweeper bot: an automated script running on a high-speed RPC node that continuously scanned the public mempool for any incoming transactions targeting the compromised wallet address.
- The classic sweeper bot operated under a rigid constraint: every state-changing transaction on the Ethereum network requires native gas to be executed. If the compromised wallet contained high-value ERC-20 tokens or valuable NFTs, but held no native gas, the attacker’s sweeper bot was temporarily paralyzed. The bot could not move the tokens because there was no gas inside the compromised wallet to pay the validators for the transfer transaction.
Consequently, the sweeper bot had to wait for the victim or a white-hat rescue team to deposit native ETH into the compromised wallet to facilitate a recovery, or for the victim to attempt to execute a transaction directly.
- The moment the sweeper bot detected a pending transaction depositing ETH into the compromised address, it calculated the exact gas fee required to frontrun any subsequent rescue transactions. Using Priority Gas Auctions or routing transactions directly to public block builders, the sweeper bot would instantly submit a transfer transaction with an extremely high gas price. The bot's transaction would be packaged at the very top of the next block, successfully sweeping the victim's assets and leaving the incoming rescue transaction to fail due to a lack of remaining tokens.
The White-Hat Escape Hatch: Flashbots and MEV-Share
- This gas requirement created a highly specialized niche for white-hat rescue operations. When a user realized their wallet key was leaked, they could contact security experts to coordinate a Flashbots Rescue. Because public mempools are heavily monitored by hacker sweeper bots, rescuers used private RPC endpoints to bypass the public mempool entirely.
- Using tools like Flashbots or MEV-Share, rescuers would construct an atomic transaction bundle containing two distinct steps. First, an external, secure wallet owned by the rescue team would send the exact amount of ETH required for gas to the compromised wallet. Second, the compromised wallet would immediately transfer its valuable ERC-20 tokens or NFTs to a secure destination address, using the newly deposited ETH to cover the gas.
- Because these two transactions were bundled together and sent directly to cooperative block builders, they were guaranteed to be executed in the exact same block, one right after the other, with zero space for an external sweeper bot to intervene. The public never saw the incoming gas deposit until the block was already mined and finalized, successfully rescuing millions of dollars in digital wealth.
3. Sweeper Bot: Unpacking the Sponsorship Exploit
- The integration of EIP-7702 has completely dismantled the security guarantees of the classic Flashbots rescue bundle by introducing gas sponsorship. Under EIP-7702, a transaction can be submitted by a third party (known as a relayer or sponsor) who pays the gas fees on behalf of the target EOA. This single modification has eliminated the classic sweeper bot's greatest bottleneck: the need for the victim's wallet to hold native gas.
- When an attacker gains access to a compromised private key in the post-Pectra era, they no longer need to deploy a passive script that waits for an incoming ETH deposit. Instead, the attacker can configure their sweeper bot to act as its own gas sponsor. The bot constructs an EIP-7702 transaction containing an authorization payload signed by the compromised EOA. This payload temporarily upgrades the victim's EOA to a smart contract wallet that contains a batch-transfer routine.
- The attacker then broadcasts this transaction from their own, fully funded external wallet. Because the attacker's wallet is the transaction origin, the gas fees are deducted directly from the attacker's balance. The EVM processes the transaction, temporarily installs the custom transfer logic onto the victim's EOA, and instantly executes a batch transfer of all ERC-20 tokens and NFTs to the attacker's secure address: all in a single, atomic, sponsor-paid step. The victim's wallet is completely drained without ever holding a single drop of native ETH.
The Two Major Attack Vectors
This new class of sweeper bot attacks operates through two distinct entry vectors:
The Compromised Private Key: If a hacker steals a seed phrase or private key via a leaked configuration file, a compromised cloud backup, or clipboard-malware, they hold the ultimate authority to sign any payload. Instead of waiting for gas, the attacker's sweeper bot immediately signs an EIP-7702 authorization payload on behalf of the victim. The bot then submits the transaction, pays the gas, and sweeps the account instantly. White-hat rescue teams cannot perform a classic Flashbots rescue because there is no funding step to bundle; the attacker can initiate the sweep at any moment of their choosing, completely independently of the victim's actions.
The Phishing-Delegation Signature: The second, even more insidious vector does not require the attacker to steal the victim's private key. Instead, it relies on deceptive phishing interfaces. When a user visits a malicious website (disguised as an airdrop claim or a portfolio optimization dashboard), the dApp prompts them to sign an off-chain message. To the untrained eye, this looks like a standard, harmless signature. In reality, the user is signing an EIP-7702 Authorization Tuple.
- Once this signature is captured, the delegation is complete. The attacker now possesses a cryptographically valid payload that allows them to upgrade the victim's EOA to point to a malicious implementation contract at any time. Because EIP-7702 transactions can be submitted by anyone, the attacker can hold this signature in reserve, waiting for weeks or months until the victim deposits a significant amount of assets into their wallet.Â
- The instant a high-value asset arrives, the attacker's sweeper bot submits the authorization list to the network, upgrades the EOA, and drains the assets using their own sponsored gas.
Table 1: Sweeper Models
| System | Gas Requirement |
| Old Sweeper | Needs victim ETH |
| New Sweeper | Uses attacker gas |
4. EVM-Level Execution Flow & State Modifications
- To understand how EIP-7702 alters the core behavior of the Ethereum Virtual Machine, we must look at the exact state-changing rules introduced by this transaction type. EIP-7702 introduces a new transaction type, formally designated by a specialized envelope wrapper. The payload of an EIP-7702 transaction includes a standard transaction structure along with a critical addition: the authorization list.
- The authorization list is represented as a list of serialized tuples containing parameters such as the chain identifier, the target smart contract address, the account nonce, and the signature components (y-parity, r, and s) generated by the EOA's private key.
- The chain identifier specifies the exact network to prevent cross-chain replay attacks. The address indicates the target smart contract implementation that the signer wishes to delegate their account to. The nonce tracks the current transaction count of the signer's EOA to prevent signature reuse or out-of-order execution. Finally, the signature components are generated by signing the hash of the authorization data.

The State Transition Process
When an EIP-7702 transaction is packaged into a block, the EVM processes the authorization list before executing any transaction payloads. For each valid tuple in the list, the EVM performs several operations:
Signature Recovery: The EVM uses the standard signature recovery algorithm to derive the public key and identify the signing authority address.
Nonce Verification: The EVM checks that the signer's on-chain nonce matches the nonce specified in the tuple. If the on-chain nonce is higher, the authorization is discarded as invalid.
Writing the Delegation Designator: If the verification succeeds, the EVM modifies the state of the authority account. It writes the delegation designator bytes directly into the account's code slot. This special prefix instructs the EVM that the account is no longer a standard EOA for execution purposes. All future external calls targeting the authority address will immediately redirect their execution context to the code residing at the delegated address.
Incrementing the Nonce: The on-chain nonce of the authority account is incremented by one to prevent the exact same authorization payload from being executed again.
5. The Destruction of Backward Compatibility: The EOA-Only Fallacy
- Beyond the immediate threat of sponsored sweeper bots, EIP-7702 introduces a systemic risk to the wider smart contract ecosystem by breaking a foundational assumption of Ethereum security: the EOA-only check. For nearly a decade, smart contract developers have utilized a specific, common security check to verify whether an incoming call originates from a standard user or another smart contract.
- Historically, this check was considered a reliable safeguard. Because standard Ethereum transactions could only be initiated by an EOA, verifying that the immediate caller matched the original initiator of the transaction guaranteed that the caller was not a smart contract.Â
- This assumption was widely used to defend against several critical vulnerabilities, such as flash loan exploits (preventing smart contracts from interacting with a protocol's functions during a single transaction block to neutralize capital-raising attacks) and reentrancy attacks (ensuring that the calling account could not execute malicious fallback functions to hijack execution loops).
The EIP-7702 Subversion
- EIP-7702 completely invalidates this check. Because an EOA can now delegate its code slot to point to an external contract, an EOA can behave exactly like a smart contract while still remaining the transaction initiator. When a delegated EOA interacts with a protocol, the caller and the transaction origin will still match, but the EOA's code slot contains active, executable bytecode that can run custom, malicious logic.
- A prominent real-world example of this vulnerability occurred on the BNB Chain. An attacker identified an unverified DeFi contract that relied on the EOA-only check to restrict access to its internal liquidity pool. The attacker deployed a malicious delegation contract, signed an EIP-7702 authorization payload on their own EOA, and initiated a transaction.
- Because the EOA carried delegated code, it successfully bypassed the contract's EOA-only check. When the protocol transferred native tokens to the EOA, it instantly triggered the delegated contract's fallback function, allowing the attacker to execute a recursive reentrancy exploit and drain the protocol.
Table 2: Recovery Techniques
| Method | Mechanism |
| Old Rescue | Private mempool bundles |
| New Rescue | Zero address reset |
6. Defensive Operations: Overwriting and Purging Malicious Delegations
- If you discover that your wallet has been compromised via a malicious EIP-7702 delegation signature, traditional security measures like revoking ERC-20 token allowances are no longer sufficient. Because the delegation pointer gives the attacker permanent execution control over your EOA, you must actively clear the delegation to reclaim your account's security.
Fortunately, the architects of EIP-7702 built a native mechanism to reset an EOA's code slot: delegating to the zero address.
- When an EOA authorizes a delegation pointing to the zero address, the EVM intercepts this as a special command. Rather than writing a delegation prefix, the EVM completely clears the account's code slot and resets its code hash back to the default empty state. This action instantly restores the wallet back to a clean, standard EOA, severing the attacker's execution control.
The Recovery Playbook: Executing a Sponsored Purge
Because a compromised wallet is likely monitored by an active sweeper bot, attempting to fund the wallet with ETH to clear the delegation is extremely risky. To safely reclaim the account, you should execute a sponsor-funded purge using a secure secondary address to pay the gas fees.
Step 1: Isolate the Compromised EOA. Stop depositing any assets or executing any transactions from the compromised wallet. Ensure you have a secure secondary wallet (with sufficient ETH to pay for gas) to act as your sponsor or relayer.
Step 2: Generate the Reset Payload. Draft an EIP-7702 authorization payload where the target address field is set to the zero address. The payload must reference the compromised EOA's current on-chain nonce. Sign this payload using the private key of the compromised EOA.
Step 3: Broadcast via the Sponsor Wallet. Using a command-line developer tool or a verified developer framework, package the signed authorization payload into an EIP-7702 transaction. Configure the transaction parameters to deduct the gas fees directly from your secure secondary sponsor wallet. Broadcast the transaction to the network.
Step 4: Verify the State Reset. Once the transaction is mined, the EVM will increment the compromised EOA's nonce and completely wipe the delegation pointer from its code slot. You can verify the reset by running a balance and code check on the address using a development command-line tool.
7. Real-Time Telemetry and On-Chain Security via DEXTools
- In the highly fragmented post-Pectra ecosystem, where modular rollups, custom gas tokens, and delegated smart contract accounts are expanding rapidly, maintaining absolute visibility over your assets is a necessity. When users interact with new DeFi protocols, yield pools, or liquid restaking frameworks, they are routinely asked to sign transactions that could, if malicious, contain hidden EIP-7702 authorization payloads.
- To shield your portfolio from these advanced phishing tactics, you must practice proactive on-chain verification. Relying on basic browser alerts is no longer sufficient; you need real-time data to audit the safety of the pools and smart contracts you interact with.
- DEXTools provides the critical analytical infrastructure needed to perform these checks before you authorize any signatures on your wallet. By entering any token's contract address directly into the advanced DEXTools Pair Explorer, you can instantly monitor live transaction histories, analyze the contract's source code verification status, check liquidity pool locks, and audit overall security trust scores.
- This look-through telemetry ensures you only interact with verified, high-integrity protocols, keeping your digital assets safe from the precalculated traps of modern drainer networks.Â
You can access DEXTools here and start trading today!
Disclaimer: This article is for informational purposes only and does not constitute investment advice, financial advice, trading advice, or any other kind of advice. DEXTools does not recommend buying, selling, or holding any cryptocurrency or token. Users should conduct their own research and consult with a qualified financial advisor before making any investment decisions. Cryptocurrency investments are volatile and high-risk. DEXTools is not responsible for any losses incurred.