تخطَّ إلى المحتوى الرئيسي

Sandwich Attack

Intermediate

هجوم الساندويتش

Also known as: Front-Running Sandwich, MEV Sandwich

Cryptocurrencies
Last updated

Definition reviewed before publishing

Our content team writes and reviews every definition before it is published, and revisits it when the way a term is used in the markets changes. The date shows the latest change to this term.

Last updated on 9 November 2026

A sandwich attack is a form of manipulation on decentralised exchanges in which an attacker sees a user's pending trade before it is executed, places a buy order immediately before it to push the price up, then a sell order immediately after it, so the user's trade sits between them like the filling in a sandwich. The user ends up trading at a worse price, and the attacker pockets the difference.

Quick summary

• Manipulation that surrounds a user's trade with two trades. • Exploits public pending transactions. • Risk falls with a lower slippage tolerance.

How it works

The attack is possible because on many public networks, transactions appear in a public waiting area before they are included in a block, so automated bots can monitor this queue and look for large trades on decentralised exchanges. When they find a trade with a high slippage tolerance, they send a buy transaction with higher fees so it executes first, raising the price in the pool; the user's trade then executes at the higher price within the slippage it allowed, and the bots sell right after. This falls under what is known as maximal extractable value (MEV), profits that can be made from ordering transactions. To reduce the risk, users set a low slippage tolerance, split large trades or use tools that send transactions privately instead of through the public queue.

Example

A user wants to buy a token worth 20,000 dollars with a 3% slippage tolerance. Bots spot the trade and buy first, lifting the price 2.5%, so the user's trade fills about 2.5% higher, a loss of roughly 500 dollars compared with the original price, and the bots then sell immediately at a profit. With slippage set at 0.5%, the trade would have failed instead of being exploited.

Where you will see it

In decentralised finance security analysis, in slippage settings on decentralised exchanges, in reports on maximal extractable value, and in private transaction tools.

Why it matters

It reveals a hidden cost of trading on decentralised exchanges, shows why slippage settings matter, and encourages caution with large trades.

How it is calculated

Approximate loss = trade value × the price move caused before it. Slippage tolerance = the maximum acceptable deviation from the expected price.

How it differs from similar terms

• Slippage: a natural gap between expected and executed price due to trade size, while a sandwich is deliberate manipulation. • Insider trading: relies on non-public information, while a sandwich exploits public pending transactions. • Arbitrage: exploiting price differences between venues without directly harming a specific user.

Common mistakes

Setting a very high slippage tolerance to make sure a trade executes, or assuming decentralised exchanges are free of manipulation. A high tolerance gives attackers room to exploit, and transparency itself makes this kind of attack possible.

Related terms