Deprecated oracle function latestAnswer() could bring fund loss #40
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-843
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-11-kelp/blob/main/src/oracles/ChainlinkPriceOracle.sol#L38
Vulnerability details
Impact
The function
ChainlinkPriceOracle.getAssetPrice()
is used to return important values used throughout the contract, the staleness of the Chainlink return values will lead to wrong calculation of the asset and other unexpected behavior.Proof of Concept
The function
ChainlinkPriceOracle.getAssetPrice()
uses Chainlink's deprecatedlatestAnswer
function (https://docs.chain.link/data-feeds/api-reference/), 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.Tools Used
Vscode
Recommended Mitigation Steps
The latestRoundData function should be used instead of the deprecated latestAnswer function and add sufficient checks to ensure that the pricefeed is not stale.
Assessed type
Oracle
The text was updated successfully, but these errors were encountered: