The OrderBook contract lacks validation for the _priceInUSDC
parameter in the createSellOrder
function, allowing users to accidentally sell valuable assets for a tiny fraction of their worth. The contract expects prices to be specified in the smallest unit of USDC (let's say 6 decimal places), but provides no safeguards against users inputting human-readable prices without the proper decimal conversion.
Likelihood: High
Users naturally think in whole units (e.g., 2000 USDC) rather than smallest units (2,000,000,000), making this error extremely common in DeFi interfaces.
The contract provides no warnings, safeguards, or validation to prevent this type of input error.
Impact: High
Users could lose nearly all value of their assets by selling them at a tiny fraction of their intended price (e.g., selling 1 ETH worth $2000 for just $0.002).
Bots and frontrunners will quickly exploit these mispriced orders, making recovery impossible once the transaction is confirmed.
The protocol's reputation would be severely damaged after users experience significant financial losses.
The following test case demonstrates how a user can accidentally lose nearly all the value of their assets due to the lack of price reasonability checks:
The Decimal Confusion:
USDC has 6 decimal places, meaning 1 USDC = 1,000,000 units
To sell 1 WETH for 2000 USDC, Alice should input 2,000,000,000 (2000e6)
Instead, she inputs just 2000, which the contract interprets as 0.002 USDC
The Contract Accepts the Order:
The contract only validates that the price is non-zero (if (_priceInUSDC == 0) revert InvalidPrice();
)
It doesn't check if the price is reasonable or within expected ranges
The order is created successfully with a price of 0.002 USDC for 1 WETH
Immediate Exploitation:
Arbitrage bots or other users will quickly spot and exploit severely underpriced assets
In this example, Bob immediately buys the 1 WETH for just 0.002 USDC
The transaction is valid and cannot be reversed
Devastating Financial Loss:
Alice receives only 1940 units (0.00194 USDC) after the protocol fee
This represents a 99.9999% loss compared to the intended 2000 USDC
The protocol also receives a much smaller fee than intended
Add a minimum price validation with a configurable threshold:
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.