Sandwich attacks remain one of the most persistent forms of value extraction in decentralized finance, particularly within automated market maker-based trading environments. As on-chain activity continues to expand across networks like Ethereum, BNB Chain, and Solana, these attacks have evolved into a systematic strategy deployed by sophisticated actors leveraging transaction ordering and market inefficiencies.
This piece examines the underlying mechanics of sandwich attacks, how they are executed in real market conditions, and the mitigation strategies emerging across both user and protocol layers.
Key Takeaways
- Sandwich attacks exploit transaction visibility and ordering in public mempools
- They are a core subset of Maximal Extractable Value in DeFi markets
- Low liquidity and high slippage tolerance increase vulnerability
- MEV infrastructure has made these attacks more systematic and scalable.
- Prevention depends on both user behavior and protocol-level design improvements.
What Sandwich Attacks Represent in DeFi
A sandwich attack is a transaction-ordering exploit where an attacker deliberately places two trades around a victim’s pending transaction to manipulate execution price. The attacker initiates a buy order before the victim’s swap and follows it with a sell order immediately after, capturing profit from the price movement induced by the victim’s trade.
This form of exploitation falls under Maximal Extractable Value, which broadly describes the value that can be extracted through control over how transactions are sequenced within a block. Rather than relying on traditional arbitrage inefficiencies, sandwich attacks specifically exploit predictable user behavior and the transparency of pending transactions.
How Sandwich Attacks Are Executed
The attack sequence begins when a user submits a swap transaction to a decentralized exchange such as Uniswap or PancakeSwap. If the trade size is large enough relative to the liquidity pool, it is expected to shift the price along the automated market maker curve.
At this stage, searchers monitoring the mempool detect the transaction and simulate its potential market impact. Once identified as profitable, the attacker constructs a coordinated sequence of transactions designed to execute in a specific order.
The first transaction increases demand for the target asset by purchasing it ahead of the victim, which shifts the price upward within the liquidity pool. When the victim’s transaction executes, it does so at this inflated price, provided the slippage tolerance allows it. Immediately after, the attacker sells the asset back into the pool, benefiting from the additional upward pressure created by the victim’s trade.
This coordinated sequence relies heavily on precise control over transaction ordering. On networks like Ethereum, such control is often achieved through MEV-aware infrastructure that allows attackers to prioritize their transactions.
Structural Factors That Enable These Attacks
The effectiveness of sandwich attacks is rooted in the design of public blockchain systems and user trading behavior. Transparent mempools expose pending transactions before they are finalized, which allows attackers to analyze and respond in real time. Without this level of visibility, identifying and exploiting individual trades would be significantly more difficult.
Liquidity conditions also shape the attack surface. Pools with limited depth amplify price impact, making it easier for attackers to manipulate execution outcomes. This is why newly launched tokens and low-liquidity pairs tend to experience a higher frequency of sandwich attacks.
User-defined slippage tolerance introduces another critical variable. When traders allow for wider slippage, they unintentionally create a buffer that attackers can exploit, ensuring the manipulated trade still executes despite unfavorable price movement.
Gas dynamics further reinforce the attacker’s advantage, as higher transaction fees can be used to secure favorable positioning within a block and guarantee execution order.
The Role of MEV Infrastructure
Modern sandwich attacks are tightly integrated into the broader MEV ecosystem, where specialized actors compete to extract value from transaction ordering. Searchers identify opportunities and construct transaction bundles, while builders assemble blocks designed to maximize extractable value before passing them to validators.
Platforms like Flashbots have introduced structured mechanisms for this process, including private relays that reduce public mempool congestion. While these systems improve efficiency and reduce chaotic gas bidding wars, they also make the execution of MEV strategies, including sandwich attacks, more systematic and scalable.
This dual effect highlights an important nuance on how infrastructure improvements can reduce network inefficiencies without fully eliminating exploitative behavior.
Market Impact and Hidden Costs
For traders, the most immediate consequence of a sandwich attack is degraded execution quality. The loss is often embedded within slippage, which makes it less visible than explicit fees but no less significant.
At scale, these attacks introduce inefficiencies into decentralized markets by distorting price discovery and redistributing value from users to specialized actors. In smaller ecosystems, repeated exposure to such behavior can discourage participation, particularly among retail users who may not fully understand the mechanics behind their losses.
Mitigation Strategies for Users
Reducing exposure to sandwich attacks requires a more deliberate approach to transaction execution. Lowering slippage tolerance limits the extent to which price can move before a transaction fails, thereby reducing the profitability of an attack.
Executing trades in high-liquidity pools minimizes price impact and reduces the opportunity for manipulation. When dealing with larger positions, breaking trades into smaller segments can also reduce visibility and make it harder for attackers to extract meaningful value.
Another increasingly effective approach involves using private transaction routing, where transactions are submitted directly to block builders rather than broadcast to the public mempool. This significantly reduces the likelihood of interception.



















