code-423n4 / 2023-10-nextgen-findings

5 stars 3 forks source link

AuctionDemo::claimAuction() - L105: Logic bug in the conditional statement where the timestamp check should be `>` instead of `>=`. #2023

Closed c4-submissions closed 10 months ago

c4-submissions commented 10 months ago

Lines of code

https://github.com/code-423n4/2023-10-nextgen/blob/a6f2397b68ef2865374c1bf7629349f25e71a44d/smart-contracts/AuctionDemo.sol#L105

Vulnerability details

Impact

Proof of Concept

If it's still unclear, let me clarify from a different perspective: Auction duration is from 0 to 10, lets say. We can only select auction winner AFTER the auction (duration). This means > 10, NOT >= 10. If we wanted to make 10 valid for auction winner selection, then we would need to make auction duration from 0 to 9, where the auction ends at 9. Now we can have >= 10 which is logically correct.

Tools Used

VSC. Manual.

Recommended Mitigation Steps

- require(block.timestamp >= minter.getAuctionEndTime(_tokenid) && auctionClaim[_tokenid] == false && minter.getAuctionStatus(_tokenid) == true);
+ require(block.timestamp > minter.getAuctionEndTime(_tokenid) && auctionClaim[_tokenid] == false && minter.getAuctionStatus(_tokenid) == true);

Assessed type

Other

code423n4 commented 10 months ago

Withdrawn by 0xSmartContractSamurai