What Is a “Sandwich Attack” and How Does It Exploit the AMM Structure?
A sandwich attack is a type of MEV where a malicious actor places two transactions around a target transaction in the same block. The attacker executes a small buy order (the "bread") just before the victim's trade, driving up the price.
The victim's trade executes at a worse price (high slippage), and then the attacker executes a sell order immediately after, profiting from the temporary price increase. This exploits the predictable price change of the AMM.