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

Chainlink oracle will return the wrong price if the aggregator hits `minPrice`

Summary

Vulnerability Details

Chainlink aggregators have a built-in circuit breaker if the price of an asset goes outside of a predetermined price band.

The result is that if an asset experiences a huge drop in value (i.e. LUNA crash) the price of the oracle will continue to return the minPrice instead of the actual price of the asset.

This would allow users to continue borrowing with the asset but at the wrong price. This is exactly what happened to Venus on BSC when LUNA crashed.

Code Snippet

File: DSCEngine.sol
// @audit missing min/max price check
345: (, int256 price,,,) = priceFeed.staleCheckLatestRoundData();
// @audit missing min/max price check
363: (, int256 price,,,) = priceFeed.staleCheckLatestRoundData();

Impact

This could enable users to keep borrowing the asset at an incorrect price.

Tools Used

Manual

Recommendations

Consider using the following checks:

(, int256 price,,,) = priceFeed.staleCheckLatestRoundData();
// minPrice check
require(price > minPrice, "Min price exceeded");
// maxPrice check
require(price < maxPrice, "Max price exceeded");

Support

FAQs

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