Root Cause: The placeBid function enforces a strict condition using require(msg.value > requiredAmount, "First bid must be > min price"), which prevents the first bid from being exactly equal to the NFT’s minPrice. The requiredAmount is typically set to the minPrice for the initial bid, making the > operator overly restrictive. This design choice deviates from standard auction logic, where bids equal to the minimum price should be permissible.
Impact: This restriction blocks legitimate bidders from placing valid bids at the minPrice, potentially leading to missed sales opportunities and reduced marketplace usability. It frustrates users, breaks expected auction behavior, and may harm trust in the platform, as sellers and bidders rely on consistent and intuitive auction rules.
Normal Behavior: In a typical auction system, the first bid should be allowed to match the minimum price set by the seller, enabling the auction to start. The placeBid function in BidBeastsNFTMarket is intended to manage bids, but its current implementation is:
Here, requiredAmount is derived from the minPrice for the first bid, but the > comparison rejects bids exactly equal to minPrice.
Vulnerable Behavior: When a bidder attempts to place a bid equal to minPrice, the transaction reverts with "First bid must be > min price". This behavior is unintuitive, as it contradicts standard auction practices where the minimum price is a valid starting point, potentially causing users to abandon the platform or misjudge bidding strategies.
Likelihood: Medium. The issue occurs whenever a bidder attempts to place the first bid exactly at minPrice, a common scenario in auctions where users test the market with the minimum acceptable bid. The likelihood increases with inexperienced users unfamiliar with the strict requirement.
Impact: Medium. While this does not result in direct asset loss, it disrupts the auction process, leading to missed sales, reduced platform adoption, and potential reputational damage. The impact is significant in a competitive marketplace where usability is critical.
Mint NFT and approve marketplace.
List NFT with MIN_PRICE.
Attempt to place a bid exactly equal to MIN_PRICE.
Transaction reverts with "First bid must be > min price".
Add the following to the BidBeastsNFTMarketTest.t.sol test:
Setup: An NFT is minted, approved, and listed with a MIN_PRICE (e.g., 1 ether).
Attack/Issue: BIDDER_1 attempts to place a bid equal to MIN_PRICE, triggering the revert due to the > condition.
Result: The test passes, confirming that bids at the minimum price are rejected, highlighting the unintended restriction.
Ensure unit tests include cases where the bid is exactly minPrice to prevent regressions.
This aligns the contract behavior with standard auction expectations and improves user experience.
Update the require statement in BidBeastsNFTMarket::placeBid to allow bids equal to the minimum price:
Condition Change: Replacing > with >= allows the first bid to match minPrice, enabling valid auction starts while still enforcing increments for subsequent bids.
Consistency: This adjustment aligns the contract with industry standards, where the minimum price is a permissible starting bid.
User Experience: It reduces frustration and prevents missed opportunities, enhancing marketplace usability.
First bid validation uses > instead of >=, preventing valid starting bids.
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.