The NFT auction contract allowed an owner to create multiple auctions for the same token because the escrow transfer did not revert when an auction already existed. An attacker could then cancel both auctions, permanently locking the last bidder's funds.
Alice (the attacker) calls createReserveAuction, and creates one like normal. let this be auction id 1.
Alice calls createReserveAuction again, before any user has placed a bid (this is easy to guarantee with a deployed attacker contract). We’d expect that Alice wouldn’t be able to create another auction, but she can, because _transferToEscrow doesn’t revert if there’s an existing auction. let this be Auction id 2.
Since nftContractToTokenIdToAuctionId[nftContract][tokenId] will contain auction id 2, all bidders will see that auction as the one to bid on (unless they inspect contract events or data manually).
Alice can now cancel auction id 1, then cancel auction id 2, locking up the funds of the last bidder on auction id 2 forever.
Recommended Mitigation Steps
Prevent NFT owners from creating multiple auctions.
Bidder’s funds are stuck in escrow in an unrecoverable way without an upgrade, and even with an upgrade it would have been non-trivial to offer a migration path to recover the funds (but it would have been possible to recover correctly).
It allows sellers to stop the clock and/or back out of an auction. Normally once a bid is received we do not allow the seller to cancel the auction. With this bug, they could have created a new auction and then cancel that in order to back out of the deal entirely. This violates trust with collectors.
We have fixed this problem by adding the following code to createReserveAuction:
// This check must be after _transferToEscrow in case auto-settle was required
if (nftContractToTokenIdToAuctionId[nftContract][tokenId] != 0) {
revert NFTMarketReserveAuction_Already_Listed(nftContractToTokenIdToAuctionId[nftContract][tokenId]);
}
The original report as published on Code4rena, by 0xliumin. 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.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
The function that moves the NFT into escrow did not check whether an auction already existed for that token, so a second auction could be created and its ID overwrote the first.
Impact
Bidders' funds could be permanently locked in escrow, and sellers could back out of an auction after receiving a bid.
What the attacker needed
Attacker owns the NFT; no bid placed before second auction; attacker can deploy a contract
The fix
The project fixed it by adding a check in createReserveAuction that reverts if an auction ID already exists for the token.
How it was found
The attacker calls createReserveAuction to create a normal auction (id 1).
Before any bid, the attacker calls createReserveAuction again to create a second auction (id 2).
The mapping now points to auction id 2, so bidders see and bid on that auction.
The attacker cancels auction id 1, then cancels auction id 2, locking the last bidder's funds.
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.
Generating the AI write-up for this report.
This usually takes about a minute. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
An NFT owner could list the same item for auction more than once. When someone bid on the second listing, the owner cancelled both auctions, and the bidder's money got stuck with no way to get it back.
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.