-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of deprecated Chainlink function latestAnswer()
#659
Comments
raymondfam marked the issue as sufficient quality report |
raymondfam marked the issue as duplicate of #32 |
raymondfam marked the issue as insufficient quality report |
raymondfam marked the issue as not a duplicate |
raymondfam marked the issue as duplicate of #34 |
raymondfam marked the issue as sufficient quality report |
raymondfam marked the issue as not a duplicate |
raymondfam marked the issue as duplicate of #215 |
fatherGoose1 marked the issue as unsatisfactory: |
This issue also mentions the decimals issue with the Chainlink oracle as the issue #479 |
fatherGoose1 marked the issue as not a duplicate |
fatherGoose1 marked the issue as duplicate of #479 |
fatherGoose1 changed the severity to QA (Quality Assurance) |
Lines of code
https://github.com/code-423n4/2023-11-kelp/blob/f751d7594051c0766c7ecd1e68daeb0661e43ee3/src/oracles/ChainlinkPriceOracle.sol#L38
Vulnerability details
Explanation
According to Chainlink's documentation, the latestAnswer function is deprecated. This function won't revert if no answer has been reached. Instead, it will return 0. Chainlink oracles are used for fetching the price of all the assets that can be deposited into the protocol. As for now, the assets are cbETH, rETH and stETH.
This prices will be used for calculating the price of rsETH, which is used for calculating the amount of rsETH the user will receive for the deposit he made.
Impact
The protocol can DDoS if no prices are fetched correctly or users could mint rsETH for cheaper if some prices are correctly fetched and some others aren't.
Proof of Concept
In the case where all the assets' oracles return a 0, users won't be able to deposit funds since
totalETHInPool
would be 0, thereforelrtOracle.getRSETHPrice()
returning 0 and making the calculation ofrsethAmountToMint
revert since it would try do divide by 0.In case where 2/3 oracles return a 0, users would be able to mint rsETH for cheaper, since the calculations of the
totalETHInPool
would be wrong, resulting inlrtOracle.getRSETHPrice()
returning a lower value and leading to a higherrsethAmountToMint
.Tools Used
Manual review.
Recommended Mitigation Steps
Consider using
latestRoundData()
instead oflatestAnswer()
and also validating the output of it to match the following code snippet:I would also suggest that even if all the current supported tokens have 18 decimals in the price feed, the LST added in the future may not have 18 decimals in the price feed, so it would also be great to check the decimals.
Assessed type
Oracle
The text was updated successfully, but these errors were encountered: