The getPrice function in the Auction contract has an unchecked arithmetic operation that can cause an underflow, leading to a denial-of-service (DoS) condition. If reservePrice is greater than startingPrice, the subtraction operation will revert, preventing the contract from functioning correctly.
The getPrice function calculates the price dynamically but does not check if reservePrice is greater than startingPrice (in provided docs, there is nothing referring to this, so it may happen). If reservePrice > startingPrice, an underflow occurs:
Next, function buytake getPriceto calculate price that will be transferred by user to bid on the ZENO auction:
Let's assume next initial conditions:
startingPrice = 1000
reservePrice = 2000 (Invalid case)
The subtraction 1000 - 2000 underflows, causing a revert.
Output:
Error: Transaction reverted: arithmetic underflow
If the underflow occurs, the auction will become completely inoperable, preventing users from retrieving the price and making bids. This results in a full contract denial-of-service (auction with these incorrect parameters).
Manual review.
Add a check in the constructor and setPrices function to prevent invalid price ranges:
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.