What is Sandwich Attack?

1 min read Updated

A sandwich attack is an MEV strategy where an attacker places transactions before and after a victim's swap — front-running to raise the price, then back-running to sell at the inflated price.

WHY IT MATTERS

Sandwich attacks are the most visible form of MEV extraction. The attacker 'sandwiches' your swap: buys the same token before you (raising the price), lets your trade execute at the worse price, then sells after (capturing the difference).

The attacker profits from the price impact of your trade. Larger trades with higher slippage tolerance are more profitable targets. The attack is atomic — if any step fails, the entire bundle reverts.

Protection strategies: minimize slippage tolerance, use private mempools (Flashbots Protect), use MEV-protected DEXs (CoW Protocol), or submit transactions through MEV-Share for partial rebates.

FREQUENTLY ASKED QUESTIONS

How much do sandwich attacks cost victims?
Typically 0.1-2% of trade value, depending on trade size and slippage settings. Across all users, sandwich attacks extract millions monthly from DEX traders.
How to avoid sandwich attacks?
Use Flashbots Protect (private mempool), set low slippage tolerance, use MEV-protected DEXs, split large trades, or trade on L2s with centralized sequencers.
Can my wallet protect against sandwiches?
Some wallets route through private mempools by default. MetaMask has integrated Flashbots protection. Always check your wallet's MEV protection settings.

FURTHER READING

Enforce policies on every tool call

Intercept is the open-source MCP proxy that enforces YAML policies on AI agent tool calls. No code changes needed.

npx -y @policylayer/intercept
github.com/policylayer/intercept →
// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.