Bid Beasts

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

Precision Loss in Bid Increment Calculation

Root + Impact

The bid increment calculation performs division before multiplication.Because Solidity uses integer division (truncates remainders), precision is lost whenever previousBidAmount is not a multiple of 100. This results in under-calculating the required next bid amount.

Description

  • The bid increment calculation performs division before multiplication: (previousBidAmount / 100) * (100 + S_MIN_BID_INCREMENT_PERCENTAGE). This causes precision loss due to Solidity's integer division, particularly problematic for bid amounts not perfectly divisible by 100. For example, a bid of 99 wei would require only 100 wei as the next bid instead of 103 wei.


requiredAmount = (previousBidAmount / 100) * (100 + S_MIN_BID_INCREMENT_PERCENTAGE);

Risk

Likelihood:

  • This occurs whenever a new bid amount is not perfectly divisible by 100, since integer division truncates the remainder before applying the increment multiplier.

The vulnerability consistently allows bidders to place valid bids below the intended minimum increment, meaning it can be exploited in any auction with small or uneven bid amounts.


Impact:

  • Bidders can place bids with less than the intended 5% increment, potentially exploiting the system to win auctions with smaller increments than designed. This undermines the auction's economic model and could result in sellers receiving less than expected.

  • Bidders can consistently place bids that are below the intended minimum increment. This undermines the auction’s economic model by:

    • Allowing bidders to win auctions with smaller-than-expected increments.

    • Reducing seller revenues and platform fees.

    • Creating unfair bidding dynamics where bidders who exploit the flaw gain an advantage over honest bidders.


Proof of Concept

// Example with previousBidAmount = 199 wei
// Incorrect calculation: (199 / 100) * 105 = 1 * 105 = 105 wei
// Correct calculation: (199 * 105) / 100 = 208 wei
// Precision loss: 103 wei (almost 50% less than intended increment)

Recommended Mitigation

Multiply before dividing to preserve precision

requiredAmount = (previousBidAmount * (100 + S_MIN_BID_INCREMENT_PERCENTAGE)) / 100;
Updates

Lead Judging Commences

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

BidBeasts Marketplace: Integer Division Precision Loss

Integer division in requiredAmount truncates fractions, allowing bids slightly lower than intended.

Support

FAQs

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

Give us feedback!