15,000 USDC
View results
Submission Details
Severity: medium
Valid

Missing price check in `staleCheckLatestRoundData`

Summary

There is no check for the answer from latestRoundData, the value is a int256 and in some cases it can return negative value, a security recommendation is to validate this variable.

Vulnerability Details

The answer variable in OracleLib contract is used to calculate the amount of token from USD in DSCEngine.sol#getTokenAmountFromUsd() or to get the total o collateral value in `DSCEngine.sol#LgetAccountCollateralValue(), due to incorrect price the borrower can be liquidated even if he has the necessary amount of collateral to cover the debts.

Impact

Due to an invalid calculation of the price, the borrower can be liquidated earlier.
I consider this to be a low possibility because a negative price is highly unlikely to occur.

Tools Used

Manual Review

Recommendations

It is recommended to validate the answer is more than zero.

Support

FAQs

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