Bid Beasts

First Flight #49
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: low
Valid

minPrice not taken into account when bidding

minPrice not taken into account when bidding

Description

The competition's description explained that

If the highest bid meets or exceeds the minimum price:
* NFT is transferred to the winning bidder.
* Seller receives payment minus a 5% marketplace fee.

But the function placeBid as strict inequation stalement :

function placeBid(uint256 tokenId) external payable isListed(tokenId) {
...
requiredAmount = listing.minPrice;
require(msg.value > requiredAmount, "First bid must be > min price");
listing.auctionEnd = block.timestamp + S_AUCTION_EXTENSION_DURATION;
emit AuctionExtended(tokenId, listing.auctionEnd);
...
}

Risk

impact(low) : The Minimum price enforcement is properly implement, if the bid meets the minimum price ass the description said, it will not pass.

likelyhood(Medium) : It is likely to append at the beginning of the auction, not every time though.

Proof of Concept

Add this test to BidBeastsMarketPlaceTest.t.sol

function test_FirstBid_with_min_price_revert() public {
_mintNFT();
_listNFT();
vm.prank(BIDDER_1);
vm.expectRevert("First bid must be > min price");
market.placeBid{value: MIN_PRICE}(TOKEN_ID);
}

Recommended Mitigation

Change the stalement form > to >= in the placeBid function :

function placeBid(uint256 tokenId) external payable isListed(tokenId) {
...
requiredAmount = listing.minPrice;
- require(msg.value > requiredAmount, "First bid must be > min price");
+ require(msg.value >= requiredAmount, "First bid must be >= min price");
listing.auctionEnd = block.timestamp + S_AUCTION_EXTENSION_DURATION;
emit AuctionExtended(tokenId, listing.auctionEnd);
...
}
Updates

Lead Judging Commences

cryptoghost Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

BidBeasts Marketplace: First Bid > Instead of >=

First bid validation uses > instead of >=, preventing valid starting bids.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!