Sandwiching

Sandwiching is a variation of front-running. To make it a sandwich, the predatory trader finds a pending victim transaction in the blockchain P2P network and then tries to surround the transaction by placing one order just before the transaction (front-running) and one order just after it (back-running). The strategy is based on the idea of manipulating the price of an asset as a result of buying/selling the asset.

Sandwich transactions must be included in the order submitted and all transactions in the bundle must be included or none should be. This is (normally) guaranteed through miners that run MEV-Geth, a fork of Geth that allows users to submit bundle transactions directly to miners, avoiding the public mempool and risk of getting their transactions frontrun.

All blockchain transactions are openly observed in the mempool. As soon as the predatory trader notices a potential victim’s pending transaction of asset X traded for asset Y, they front-run the victim by buying asset Y. What happens is: the predator knows that the victim trade will increase the price of the asset; the attacker plans to buy the Y asset for a lower price, letting the victim buy at a higher price and then selling the asset again at a higher price afterward.

Liquidity Taker Attacks Taker

In this event, the liquidity taker tries to attack the liquidity taker who has a pending AMM DEX transaction on the blockchain P2P network. Seeing the transaction waiting to be approved, the predator emits two subsequent transactions (front-running and back-running) to benefit from the trader’s transaction. Now there are three pending transactions connected by one liquidity pool and asset pair. The miner has to choose which transaction will be approved first.

Liquidity Provider Attacks Taker

In this event, the liquidity provider tries to attack a liquidity taker. Everything begins the same: the attacker sees a pending transaction on the P2P network and then performs three transactions:

Remove Liquidity: front-running (increases victim’s slippage by reducing the market liquidity of the asset)

Add Liquidity: back-running (restores pool liquidity to the before-the-attack amount

Transact Y for X: back-running (restores asset balance of X to the before-the-attack state)

In this attack, the adversary withdraws all their assets from the liquidity pool before the victim’s transaction executes. In doing so, the predator foregoes the commission fees for the victim’s transaction. Liquidity providers receive commission fees in proportion to the liquidity they provide to the AMM DEX market.

References

Last updated