DEV Community

qanzhi111
qanzhi111

Posted on Edited on

The sandwich bot that got sandwiched: $7.5M, zero code bugs

jaredfromsubway.eth was the most active sandwich bot on Ethereum, responsible for a large share of all DEX sandwich attacks.

On June 20, 2026, someone drained it of roughly $7.5M.

Cartoon: a robot holding an infinite approve card, surrounded by fake token candies, as a hand pulls out a bag of ETH

There was no smart contract bug. No leaked key. No phishing. No malicious npm package.

The attacker studied what the bot always did, built a world where the bot's own habits worked against it, and waited.

The bot's job, and its tell

A sandwich bot watches the mempool for pending swaps, front-runs them, back-runs them, and pockets the difference. To do that at speed, it needs to approve token transfers ahead of time and execute without human review.

Some of those approvals are not revoked after the trade completes.

That is the whole vulnerability. Not a bug in the bot's code. A gap in what the bot does consistently, which is the thing you actually care about when you are building automation.

How the trap worked

The attacker spent about two weeks observing the bot's behaviour before deploying anything.

Then they deployed 66 fake token contracts designed to imitate WETH, USDC and USDT. Each was structured to look like a profitable arbitrage opportunity, because that is exactly the shape of thing the bot scans for.

When the bot traded these tokens, it granted unlimited ERC-20 transfer approval. The trade completed. The approval stayed.

Once those approvals existed, the attacker's own addresses called transferFrom() and pulled out the bot's real assets:

  • 1,474 WETH
  • $2.87M USDC
  • $2M USDT

Roughly $7.5M in the first accounting, with some reports suggesting closer to $15M across multiple rounds.

The proceeds went to Tornado Cash, with about 1,422 ETH swapped into roughly $2.4M in DAI. The bot's operator offered a 50% whitehat bounty of 2,150 ETH, worth about $3.7M, and threatened legal action. The attacker declined and kept moving.

Why this case matters beyond the irony

It is tempting to file this under "predator becomes prey" and enjoy it. The bot had extracted tens of millions from ordinary traders through sandwich attacks. Watching it get sandwiched is satisfying.

But the mechanism generalises far beyond one operator's wallet, and that is what makes it worth a serious post.

The important property is this: in a fully transparent environment, automated behaviour is observable, observable behaviour is predictable, and predictable behaviour is exploitable.

The bot was not hacked. Its pattern was read. Every automated system that interacts with public infrastructure publishes its pattern for free, every block, forever.

And 2026's automation is not just MEV bots. It is AI agents rebalancing portfolios, treasury bots executing DCA schedules, liquidation keepers, arbitrage strategies, and every "autonomous DeFi" product launched this year. Each one has a loop. Each loop has a tell. Each tell is a market.

The attacker in this case needed no capital to reveal the tell, only patience. Two weeks of watching, 66 contracts to build, then one flow of approve and one flow of transferFrom.

The approvals problem

The narrow technical lesson is about ERC-20 allowances, and it is old and still ignored.

An allowance is a standing permission that survives the transaction that created it. If your automation grants type(uint256).max to a token you just traded, you are leaving a signed blank cheque on-chain, addressed to whatever contract you approved.

The fix is not sophisticated. It is a discipline:

  • Revoke after every trade. The extra transaction costs a few cents and removes the standing permission entirely.
  • Never grant unlimited approval to a token you have not verified. The pattern "approve everything, then check" is exactly backwards.
  • Prefer permit-style signatures with short expiry where the protocol supports it, so permission expires on its own.
  • Monitor your own allowances. A list of what your addresses can be charged for is a security dashboard nobody builds.

The attacker did not need to find a way in. The bot had already opened the door and written the amount on it.

The wider lesson for anyone shipping automation

Smart contract audits tell you whether your code does what it says. They say nothing about whether your code's behaviour is exploitable by a patient third party.

The questions worth asking about any automated strategy:

Is my behaviour predictable?
If someone watched my addresses for two weeks, what would they learn? If the answer includes "which tokens I approve, in what order, at what price", then you have described an attack.

Do I clean up after myself?
Approvals, temporary permissions, leftover roles, admin flags. Every permission you grant is a liability that stays on the books until someone revokes it. Most strategies keep no ledger of their own outstanding permissions.

Do I have a honeypot test?
The attacker's method was to create tokens that look profitable and see whether the bot takes the bait. You can run that experiment on yourself, against your own bot, in a test environment, for an afternoon.

Is the human in the loop for anything that can be drained?
Not for the trade. For the permissions. A trade that goes wrong costs a spread. A permission that stays open costs the wallet.

The uncomfortable equilibrium

The bot extracted value by being faster than its victims. It lost value by being more predictable than its attacker. Both of those are properties of the same design: automated, transparent, and consistent.

That is not a moral point. It is a description of the market everyone building DeFi agents has now joined. Your agent will be observed. Whether it gets robbed depends on what it does after it trades, not during.



The archive: 61 investigations, 64 leak scans, 0 exploited

The archive. 61 on-chain investigations and 64 days of GitHub leak scanning, redacted and never used. Read the index or try the free token risk check at qanzhi111.github.io.

Top comments (0)