Normal bahaviour: According to the README "After 3 days, anyone can call endAuction(tokenId) to finalize the auction.".
Problematic behaviour: The 3 day auction duration threshold is not enforced in the contract logic. In addition, the endAuction(tokenId) function does not exist. The equivalent contract method is BidBeastsNFTMarketPlace::settleAuction. A user can settle the auction as soon as the auctionEnd has passed.
Root cause:
As seen in the code snippet below, the auction end is set to the block timestamp plus the S_AUCTION_EXTENSION_DURATION constant variable, which is set to 15 minutes in the contract.
Likelihood: High
The logic error occurs for every listed NFT. The auction end will be set to 15 minutes in the future whenever a first bid is placed.
Impact: High
All auctions in the NFT marketplace will have an initial duration of 15 minutes instead of 3 days, breaking the protocol's logic.
The following test proves that the auction can be settled when 15 minutes have passed after the first bid, assuming that no other bid has been placed. This contradicts the protocol logic outlined in the README, which states that auctions can be settled after 3 days have passed.
To run the test, include it in the Foundry test suite and test it with forge test --mt test_placeBid_AuctionCanEndAfter15Mins.
To mitigate the logic error, a new constant variable should be added to the contract with the initial auction duration:
Solution A:
When the first bid on a listed NFT is placed, the auction end should be set as follows:
Solution B:
Set the auctionEnd to block timestamp + AUCTION_INITIAL_DURATION when the NFT is listed in the marketplace:
This solution requires a re-work of the logic in the contract whenever the auctionEnd variable is used in a contract method.
Finally, the endAuction(tokenId) method in the README should be corrected to settleAuction(tokenId).
Documentation for BidBeasts Marketplace is incomplete or inaccurate, potentially leading to misconfigurations or security misunderstandings.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.