Skip to content
Business logic Audit finding Intermediate

Highest bid in first auction can get irretrievably stuck in the protocol

If the first auction in a protocol with no founder fees is paused and unpaused, the highest bid and the first NFT become permanently stuck because the unpause function creates a new auction without settling the existing one. An attacker could lose their bid and not receive the NFT.

PwnPatrol Follow

Originally disclosed on Code4rena

Submitted by PwnPatrol, also found by davidbrai, MiloTruck, and pauliax

Auction.sol#L248-L254

If the first auction is paused and unpaused in a protocol deployed with no founder fees, the highest bid (as well as the first NFT), will get stuck in the protocol with no ability to retrieve either of them.

Proof of Concept

In a protocol with founder ownership percentage set to 0, the first tokenId put to auction is #0.

If the first auction in such a protocol is paused and unpaused, the check for if (auction.tokenId == 0) will pass and _createAuction() will automatically be called, minting the next token and starting a new auction based on token #1.

The result is that highestBid and highestBidder are reset, the first auction is never settled, and the highest bid (as well as NFT #0) will remain stuck in the platform.

The following test confirms this finding:

function test_PauseAndUnpauseInFirstAuction() public {
    address bidder1 = vm.addr(0xB1);
    address bidder2 = vm.addr(0xB2);

    vm.deal(bidder1, 100 ether);
    vm.deal(bidder2, 100 ether);

    console.log("Deploying with no founder pct...");
    deployMockWithEmptyFounders();

    console.log("Unpausing...");
    vm.prank(founder);
    auction.unpause();

    console.log("Bidder makes initial bid.");
    vm.prank(bidder1);
    auction.createBid{ value: 1 ether }(0);
    (uint256 tokenId_, uint256 highestBid_, address highestBidder_,,,) = auction.auction();
    console.log("Currently bidding for ID ", tokenId_);
    console.log("Highest Bid: ", highestBid_, ". Bidder: ", highestBidder_);
    console.log("Contract Balance: ", address(auction).balance);
    console.log("--------");

    console.log("Pausing and unpausing auction house...");
    vm.startPrank(address(treasury));
    auction.pause();
    auction.unpause();
    vm.stopPrank();

    console.log("Bidder makes new bid.");
    vm.prank(bidder2);
    auction.createBid{ value: 0.5 ether }(1);
    (uint256 tokenId2_, uint256 highestBid2_, address highestBidder2_,,,) = auction.auction();
    console.log("Currently bidding for ID ", tokenId2_);
    console.log("Highest Bid: ", highestBid2_, ". Bidder: ", highestBidder2_);
    console.log("Contract Balance: ", address(auction).balance);

Tools Used

Manual Review, Foundry

Recommended Mitigation Steps

Remove the block in unpause() that transfers ownership and creates an auction if auction.tokenId == 0 and trigger those actions manually in the deployment flow.

Alex the Entreprenerd (judge) decreased severity to Medium and commented:

The warden has shown how, due to a specific set of circumstances, which can happen exclusively during the first auction:

  • If the first auction has a paying user
  • The id is 0 (not minted to owner)
  • And it get’s paused

Then on restart the highestBidder will lose their ETH as well as not receive the NFT.

A more appropriate behaviour would be to force settle if a bid was there, or to handle token0 like any other.

Because of the conditionality of the finding, Medium Severity is appropriate.

Minting the first token to a founder or settling before unpausing will avoid this.

iainnash (Nouns Builder) confirmed


The original report as published on Code4rena, by PwnPatrol. 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

The unpause function creates a new auction when the current token ID is 0, without first settling any existing bids, so the previous auction's state is overwritten.

Impact

The highest bidder loses their bid and does not receive the NFT, and both remain stuck in the contract.

What the attacker needed

Protocol deployed with no founder fees; First auction has a bid; Auction is paused and unpaused

The fix

Remove the block in unpause() that transfers ownership and creates an auction if auction.tokenId == 0 and trigger those actions manually in the deployment flow.

How it was found

  1. Deploy the protocol with founder ownership percentage set to 0.
  2. Unpause the auction to start the first auction for token #0.
  3. Place a bid on token #0.
  4. Pause and then unpause the auction house.
  5. Observe that a new auction for token #1 starts and the previous bid and token #0 are stuck.

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.

In an auction system, when someone bids, their money is held until the auction ends and they either get the item or a refund. Here, if the very first auction is paused and then restarted, the system forgets about the first auction and starts a new one, so the bidder's money and the item are locked forever. This happens because the restart code doesn't check if there was already a bid.

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 PwnPatrol

View all

4 more disclosed reports, best first.

More from Nouns Builder contest

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.