Understanding MEV attacks
Maximal Extractable Value (MEV) attacks have become a significant concern for crypto traders. Whether you’re a beginner or an experienced trader, understanding MEV attacks is essential to protecting your transactions and ensuring fair trading practices.
In this article, we explain what MEV attacks are, how they work, and the best strategies for safeguarding yourself against them.
MEV Attacks Go Beyond Standard Transaction Fees
Crypto traders are familiar with structural fees, such as:
-
Exchange fees – Charges applied by centralized or decentralized exchanges.
-
Execution fees – Costs associated with executing trades.
-
Gas fees – Payments made to blockchain miners or validators for processing transactions.
However, MEV attacks differ from these standard fees. Rather than being inherent costs of using the blockchain, MEV attacks exploit vulnerabilities in the transaction processing model to extract additional value at the expense of traders.
“Inevitable” MEV vs MEV Attacks
What is MEV?
MEV refers to the value that can be extracted from a blockchain transaction beyond standard fees. This extraction is done by reordering, inserting, or censoring transactions before they are confirmed on-chain.
MEV is a hidden tax on all types of Ethereum transactions. That means any time you want to transact in DeFi: from buying or selling an NFT, lending tokens to a liquidity pool, or swapping one token for another, a group of opportunistic users known as “searchers” have the opportunity to see your trade, and manipulate the criteria surrounding your trade to ensure they make profit, at your expense.
There are lots of different ways MEV can take place on Ethereum, which we’ll explore further down in the article. But for now, it’s important to understand the mechanics of MEV, and their presence on many chains like Ethereum.
The MEV Debate: Good or Bad?
Some argue that MEV is a natural incentive mechanism compensating searchers and validators for optimizing transaction sequencing. Others see it as an unfair exploitation that degrades user experience and creates hidden costs.
Want to read more about this debate? We have an article that explores the pros and cons in more detail.
MEV makes money for searchers, block builders, and Ethereum validators at the expense of regular users, especially beginners who don’t know how to protect themselves. As of the time of writing, sandwich attacks on AMMs and aggregators alike generate almost $1 million in profit for searchers each week.
Over time, persistent MEV erodes market confidence as traders realize they are at a constant disadvantage to more sophisticated actors. Ultimately, MEV may pose an existential threat to blockchain ecosystems like Ethereum, so it’s imperative for solutions to emerge that protect everyday traders from price exploitation.
The reality is, there is little appetite to change the design of chains like Ethereum, meaning MEV is here to stay. While it does help prices remain consistent across different liquidity pools, it creates a hierarchy between sophisticated actors looking for arbitrage and regular users unaware that their transactions could be exploited.
What is an MEV Attack?
An MEV attack is a deliberate manipulation of transaction ordering in a way that unfairly profits a searcher at the expense of traders. MEV attacks actively exploit transaction sequencing vulnerabilities.
Overview: How Searchers Implement an MEV Attack
MEV attacks exploit the mempool, a public waiting area where transactions reside before being confirmed. Here’s how searchers implement an MEV attack:
-
Transactions enter the mempool before being included in a block.
-
MEV searchers monitor the mempool for profitable opportunities.
-
Searchers select, reorder, or delay transactions to maximize their gains.
-
They execute transactions that benefit from market movement, often at the expense of regular traders.
Example of an MEV Attack
Imagine a trader places a large buy order for a token. A searcher detects this order in the mempool and inserts their own buy order first. Once the trader’s transaction pushes the price up, the searcher sells the token at a higher price—pocketing the profit at the trader’s expense.
Common Types of MEV Attacks
Frontrunning Attacks
Frontrunning is when a bot sees a profitable transaction in a public mempool, duplicates it, and places their own order in front of the victim transaction, extracting its value for themselves.
If you’re interested in understanding frontrunning more fully, check out our frontrunning blog post.
Backrunning Attacks
These attacks are similar to frontrunning but in reverse. In backrunning, the attacker places a transaction after the victim transaction to capitalize on any arbitrage left by the victim’s order. Frontrunning and backrunning transactions are not very common by themselves, but a combination of the two, known as a “sandwich attack,” accounts for most MEV.
If you’re interested in understanding backrunning more fully, check out our backrunning blog post.
Sandwich Attacks
Sandwich attacks combine frontrunning and backrunning, placing a buy order before the victim transaction and a sell order directly after. This creates a “sandwich” of the victim transaction.
If you’re interested in understanding sandwich attacks more fully, check out our sandwich attacks blog post.
Loss-Versus-Rebalancing (LVR)
LVR is a sophisticated strategy where MEV searchers exploit the difference between a DEX’s price and an external market price.
Targeting liquidity providers, LVR is a form of MEV responsible for more price exploitation than all other forms of MEV combined. Many liquidity providers haven’t even heard of LVR, but it costs them 5–7% of their liquidity, resulting in hundreds of millions lost each year. In fact, when accounting for LVR, many of the largest liquidity pools are not profitable for LPs at all.
If you’re interested in understanding LVR more fully, check out our LVR blog post.
How MEV Attacks Hurt Crypto Traders
Maximal Extractable Value (MEV) attacks pose serious risks to both individual traders and the broader decentralized finance (DeFi) ecosystem. These attacks allow validators, miners, or other privileged actors to manipulate transactions for their own gain, leading to inefficiencies, increased costs, and a loss of trust in DeFi markets.
The negative impacts of MEV can be categorized into four major areas: unexpected losses and slippage, compromised trade execution, distorted market conditions, and a general erosion of confidence in decentralized trading platforms.
We explore each of these in turn below.
Unexpected Losses and Slippage
One of the most immediate consequences of MEV attacks is that traders often experience worse-than-expected execution prices. This occurs due to front-running and sandwich attacks, two common forms of MEV exploitation.
-
Front-running: A validator or miner sees a pending trade and inserts their own transaction ahead of it, profiting from price changes before the original trade is executed. This forces the original trader to buy at a higher price or sell at a lower price than anticipated.
-
Sandwich attacks: This occurs when an attacker places one trade before and another trade after a target transaction. By manipulating prices through these additional transactions, the attacker forces the victim to complete their trade at a disadvantageous rate, profiting from the resulting price changes.
Both types of attacks create additional transaction costs, leading to unnecessary losses for unsuspecting traders. Even small-scale traders who frequently engage in swaps and liquidity provision can suffer from repeated losses over time, making DeFi trading less attractive.
Compromised Trade Execution and Price Distortion
MEV attacks undermine the integrity of decentralized markets by interfering with the natural process of price discovery. Price discovery refers to the process by which market prices are determined based on supply and demand dynamics. However, when MEV bots and validators manipulate transactions, the resulting prices are no longer purely organic.
For example, large MEV attacks can lead to artificial price swings that do not reflect actual market sentiment. Traders making decisions based on manipulated prices may enter trades under false assumptions, increasing their risk of losses. Additionally, compromised trade execution makes it harder for traders to place orders with confidence, as they cannot be certain their transactions will be processed fairly.
Skewed Markets and Artificial Inefficiencies
MEV-driven market manipulation can introduce significant inefficiencies that distort normal trading activity. Instead of functioning as a free and competitive environment, DeFi markets become skewed in favor of those who have privileged access to transaction data.
As a result, the markets may experience:
-
Reduced liquidity, as traders hesitate to provide liquidity, knowing they may be exploited.
-
Increased volatility, due to sudden and unpredictable price swings caused by MEV bots.
-
Barriers to entry for new traders who cannot compete with sophisticated MEV strategies.
These inefficiencies hinder DeFi’s ability to serve as a viable alternative to traditional finance.
Erosion of Trust in DeFi
Finally, MEV attacks contribute to growing distrust in decentralized finance. When traders repeatedly experience unexplained losses, poor execution, and unfair market conditions, they begin to question whether DeFi is truly decentralized and transparent.
If MEV exploitation continues unchecked, DeFi platforms risk losing users, stalling adoption, and facing increased regulatory scrutiny. Therefore, addressing MEV challenges is crucial to ensuring a fair and sustainable DeFi ecosystem.
Protect Yourself Against MEV Attacks
MEV Blockers
MEV blockers reduce vulnerability to attacks by protecting transactions from manipulation. They work by preventing transactions from being publicly visible in the mempool, making it harder for searchers to exploit them. Read more about MEV blockers here.
How CoW Swap Mitigates MEV Attacks
CoW Swap gives traders the tools they need to protect themselves from MEV, so when you’re trading through https://swap.cow.fi/ you’re protected from the majority of opportunistic searchers, regardless of the size or type of trade.
CoW Swap relies on 3 main features to keep you safe from MEV:
-
Delegated Trade Execution
-
Coincidence of Wants
-
Uniform Clearing Prices
Let’s dive in!
Delegated Trade Execution
On CoW Swap, all transactions are routed through a decentralized network of “solvers” — independent algorithms that are responsible for finding the best execution price for your trades.
When you submit a trade on CoW Swap, rather than initiating a blockchain transaction like you would on a platform like Uniswap, you instead submit a signed “intent to trade” message. This means that CoW Swap can perform optimizations on your trade that would not be possible if you submitted the transaction directly to the blockchain.
These optimizations include finding Coincidences of Wants, adjusting the slippage tolerance dynamically, and completing your trade at an optimal price during the time of execution.
Since it is the solvers who execute your trade on your behalf, you are never directly exposed to the public mempool, meaning that you are protected from MEV at all times.
Whatever price solvers quote you at the time you place your order is actually the worst price that your order will be executed at (it may complete at a better price if solvers find a better execution path). All risk of MEV is taken on by the solver itself.
Coincidence of Wants
CoW Swap’s delegated trade execution mechanism has another major advantage — it can match your orders off-chain.
Any time you submit a trade on CoW Swap, solvers start looking for the best way to execute it. Before checking on-chain liquidity, solvers check other incoming orders on CoW Swap’s current batch auction to see if your trades can be matched peer-to-peer.
Here’s how it works:
Let’s say you’re looking to trade ETH for USDC. You submit your order and solvers see that someone else in that batch is actually looking to trade USDC for ETH — the opposite of your trade — at the same time. These two trades will be matched with each other in a “Coincidence of Wants” (CoW) which allows traders to swap their assets with each other directly (one to one or many to many), thereby saving on gas fees, liquidity provider fees, price impact, and also bypassing MEV risks.
CoW Swap’s founders were inspired by the potential for Coincidence of Wants to provide lower prices for everyday Ethereum users (it’s in the name!). This mechanism is one of the cheapest and most secure ways to make a DeFi trade, and since you’re not using on-chain liquidity pools, your Coincidence of Wants trade cannot be subject to MEV attacks.
Uniform Clearing Prices
As a third line of defense against MEV, CoW Swap ensures all orders complete under a “Uniform Clearing Price” (UCP).
Upon submitting your trade, your order gets included in a batch auction alongside other pending orders in the queue. All of the orders within a batch trade for the same price on the blockchain, a phenomenon referred to as “Uniform Clearing Price” (UCP).
To understand how UCP works on CoW Swap, we first have to consider how DeFi trading works on traditional DEXs. On a normal decentralized exchange, if 8 people want to trade ETH for USDC, each of their trades clears at a slightly different price since DEXs process trades in a sequential manner even though they might be happening concurrently (within the same Ethereum block).
This leaves room for MEV because the order in which transactions are processed heavily impacts the prices that users get. Searchers are constantly monitoring DEX trades, looking for opportunities like these where they can reorder transactions to their advantage.
On CoW Swap, if the same 8 people are making that trade, as long as they are in the same batch auction, each order will be settled for the same clearing price when it goes on-chain. This leaves no room for MEV attacks since all prices are the same, meaning that transaction ordering becomes irrelevant.
Learn how CoW Swap solves the MEV problem.
Final Thoughts
MEV attacks exploit transaction sequencing for profit, often at the expense of everyday traders. While some MEV activities may be considered an unavoidable part of DeFi, MEV attacks actively harm market fairness.
Understanding these attacks and using tools like MEV blockers and fair trading platforms can help protect your transactions and ensure a more equitable DeFi ecosystem.
Interested in learning about MEV and what measures you can deploy to help keep yourself protected? Check out the below.