Overview
A sandwich attack is a sophisticated form of front-running. The attacker 'sandwiches' a victim's trade between two of their own transactions to profit from the price movement caused by the victim.
The Process
- Front-run: Attacker buys the token the victim is about to buy, pushing the price up slightly.
- Victim Trade: The victim buys the token at the now-higher price, pushing it up even further.
- Back-run: The attacker immediately sells the tokens they bought in step 1 at the new, higher price.
Result
The victim gets a worse price (more slippage), and the attacker walks away with a risk-free profit.