Skip to content
Business logic Audit finding Intermediate

MEV bots can win all the auctions when Auction is paused

The Auction contract's addBid function is protected by whenNotPaused, but the contract lacks external pause/unpause functions. If pausing were possible, MEV bots could front-run the pause transaction to place bids on all ongoing auctions, winning them for a fraction of their price.

DadeKuma Follow with SovaSlava

Originally disclosed on Code4rena

Submitted by DadeKuma, also found by SovaSlava

MEV bots may bid on all the ongoing auctions before Auction is paused by frontrunning it with the addBid function.

This can lead to bots winning all the auctions for a fraction of their price. Especially auctions that are almost ended, as no one is able to bid until the contract is unpaused.

Proof of Concept

No one will be able to bid when the contract is paused, but bots can simply front-run the pause by looking at the mempool:

	function addBid(uint256 lotId) external payable override whenNotPaused {
	    // reject payments of 0 ETH
	    if (msg.value == 0) revert InSufficientETH();

	    LotItem storage lotItem = lots[lotId];
	    if (block.number > lotItem.endBlock) revert AuctionEnded();

	    uint256 totalUserBid = lotItem.bids[msg.sender] + msg.value;

	    if (totalUserBid < lotItem.highestBidAmount + bidIncrement) revert InSufficientBid();

	    lotItem.highestBidder = msg.sender;
	    lotItem.highestBidAmount = totalUserBid;
	    lotItem.bids[msg.sender] = totalUserBid;

	    emit BidPlaced(lotId, msg.sender, totalUserBid);
	}

A word about severity; the contract extends PausableUpgradeable:

	contract Auction is IAuction, Initializable, AccessControlUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable

Also, it has several functions that have the whenNotPaused modifier:

	function createLot(uint256 _sdAmount) external override whenNotPaused

	function addBid(uint256 lotId) external payable override whenNotPaused

However, it doesn’t have any pause/unpause functions that are external/public, as they have internal visibility by default in PausableUpgradeable; as such, the contract can’t be paused with the current implementation.

However, this may change in the future as the contract is upgradeable, so I still consider this issue valid.

Recommended Mitigation Steps

Consider removing the whenNotPaused modifier from addBid, so ongoing auctions may be ended even when the contract is paused.

Assessed type

MEV

manoj9april (Stader) disputed and commented:

Bots can win the auction by frontrunning if that ensures a better price than the current bid (which it does) Also this is an duplicate issue of #70

Picodes (judge) commented:

I don’t think this is a duplicate of #70. This issue is specifically about the fact that pausing an auction decreases its time and that MEV bots/the admin could benefit from this. It is a valid issue, in the sense that nothing is done to prevent auctions from being closed by a call to pause, which would break the system.

sanjay-staderlabs (Stader) commented:

Hi @Picodes - thanks for pointing it out. It turns out for the mitigation of issue 383, we have removed PausableUpgradeable from the Auction contract; hence, removing the whenNotPaused modifier from addBid function. This issue is no longer relevant. Please see if we can close this or let me know what you think.


The original report as published on Code4rena, by DadeKuma. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the addBid function has a whenNotPaused modifier, but the contract does not expose external pause/unpause functions, so pausing is impossible; if it were possible, front-running the pause would allow cheap auction wins.

Impact

MEV bots could win all ongoing auctions for a fraction of their price, especially those about to end, because no one can bid while the contract is paused.

What the attacker needed

Contract must be pausable; bot can front-run pause transaction

The fix

The issue was fixed by removing PausableUpgradeable from the Auction contract, which also removed the whenNotPaused modifier from addBid.

How it was found

  1. A bot monitors the mempool for a pause transaction.
  2. The bot front-runs the pause by calling addBid with a bid that meets the minimum increment.
  3. The pause transaction is mined, preventing further bids.
  4. The bot wins the auction at a low price.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This is a smart contract auction where people place bids. The contract has a safety switch to pause bidding, but the switch cannot be flipped by anyone. If it could, a bot could watch for the pause command and quickly place a bid just before the pause takes effect, winning the auction cheaply because no one else can bid while paused.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by DadeKuma

View all

19 more disclosed reports, best first.

More from Stader Labs

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.