Casting the price received from the Chainlink oracle from int256
to uint256
will lead to an underflow and near-infinite minting of DSC when the input is smaller than 0.
In getUsdValue()
the asset's price in USD returned by the oracle is cast to uint256
from int256
. This can lead to an underflow where the price returned is near type(uint256).max
.
A negative price from a Chainlink oracle is possible, for example in the case of oil futures as stated by Patrick Collins in this StackOverflow question.
Since the audit readme clearly states that the protocol code should work the same regardless of the asset basket, it should account for edge cases such as these.
With a price of token x at type(uint256).max
, it is possible to mint infinite DSC which could be used to exchange for other assets on exchange platforms, causing the stablecoin to lose its peg to USD and ultimately become worthless.
Manual review
Add a check that reverts if the price from the oracle is negative.
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.