Open sherlock-admin opened 1 year ago
Sponsor comments:
Good point to switch away from using the deprecated method, which we will look into.
However from this issue it is not clear how / if there is any actual vulnerability resulting from the use of this method.
--
Agree with @ckoopmann , the proposed fix of using latestRoundData() looks reasonable to me
--
I switched to confirmed / disagree with severity as this issue is factually correct and will result in us changing the code, but does not seem to have any real adverse consequences.
I do believe that this should remain as a medium. Not just for the impact stated by the watson, but also because Chainlink might simply not support it anymore in the future.
Switched to using latestRoundData
and adding a configurable maxPriceAge that is compared against the updatedAt
value.
Fixed in:
https://github.com/IndexCoop/index-coop-smart-contracts/pull/142
Oracle was changed to AAVEOracle, which also fixed this issue
oxchryston
medium
Chainlink price feed is
deprecated
, not sufficiently validated and can returnstale
prices.Summary
The function
_createActionInfo()
uses Chainlink's deprecated latestAnswer function, this function also does not guarantee that the price returned by the Chainlink price feed is not stale and there is no additional checks to ensure that the return values are valid.Vulnerability Detail
The internal function
_createActionInfo()
uses callsstrategy.collateralPriceOracle.latestAnswer()
andstrategy.borrowPriceOracle.latestAnswer()
that uses Chainlink's deprecated latestAnswer() to get the latest price. However, there is no check for if the return value is a stale data.Impact
The function
_createActionInfo()
is used to return important values used throughout the contract, the staleness of the chainlinklink return values will lead to wrong calculation of the collateral and borrow prices and other unexpected behavior.Code Snippet
https://github.com/IndexCoop/index-coop-smart-contracts/blob/317dfb677e9738fc990cf69d198358065e8cb595/contracts/adapters/AaveLeverageStrategyExtension.sol#L889
Tool used
Manual Review
Recommendation
The
latestRoundData
function should be used instead of the deprecatedlatestAnswer
function and add sufficient checks to ensure that the pricefeed is not stale.