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.
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
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
auctionsfrom being closed by a call topause, 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
PausableUpgradeablefrom theAuctioncontract; hence, removing thewhenNotPausedmodifier fromaddBidfunction. This issue is no longer relevant. Please see if we can close this or let me know what you think.
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
- A bot monitors the mempool for a pause transaction.
- The bot front-runs the pause by calling addBid with a bid that meets the minimum increment.
- The pause transaction is mined, preventing further bids.
- 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.