Crypto glossary
Sandwich attack
A sandwich attack is a MEV tactic in which a bot places one trade just before and one just after a victim's DEX swap to profit from the price move it causes.
When a user submits a large swap to a public mempool, bots can see it before it is confirmed. The attacker buys the same token first, pushing the price up, lets the victim's trade execute at that worse price, and then sells immediately after. The victim's swap is the filling between the attacker's two trades, hence the name.
The profit is limited by the victim's slippage tolerance: the higher it is, the more the bot can extract. Sandwich bots are among the most common forms of MEV on Ethereum and Solana, and validators or block builders can include them by ordering transactions to their advantage.
Users can reduce exposure by setting tight slippage, splitting large orders, and sending trades through private transaction relays or DEX aggregators with MEV protection. Very low slippage, however, makes trades fail more often in volatile markets.
Example
A user swaps $50,000 of USDC for a small-cap token with 3% slippage allowed; a bot buys first, the user receives about 2.5% fewer tokens, and the bot sells right after for a profit of roughly $1,000 before fees.