-
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
Risk of Deprecated Chainlink Function: latestAnswer #55
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-215
edited-by-warden
grade-c
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Comments
c4-submissions
added
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
labels
Nov 11, 2023
c4-submissions
added a commit
that referenced
this issue
Nov 11, 2023
raymondfam marked the issue as insufficient quality report |
c4-pre-sort
added
the
insufficient quality report
This report is not of sufficient quality
label
Nov 15, 2023
raymondfam marked the issue as duplicate of #34 |
raymondfam marked the issue as sufficient quality report |
c4-pre-sort
added
sufficient quality report
This report is of sufficient quality
and removed
insufficient quality report
This report is not of sufficient quality
labels
Nov 17, 2023
raymondfam marked the issue as not a duplicate |
raymondfam marked the issue as duplicate of #215 |
c4-judge
added
the
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
label
Nov 29, 2023
fatherGoose1 marked the issue as unsatisfactory: |
c4-judge
removed
the
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
label
Dec 4, 2023
fatherGoose1 changed the severity to QA (Quality Assurance) |
c4-judge
added
downgraded by judge
Judge downgraded the risk level of this issue
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
labels
Dec 4, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-215
edited-by-warden
grade-c
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
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/c5fdc2e62c5e1d78769f44d6e34a6fb9e40c00f0/src/oracles/ChainlinkPriceOracle.sol#L37-L39
https://github.com/code-423n4/2023-11-kelp/blob/c5fdc2e62c5e1d78769f44d6e34a6fb9e40c00f0/src/LRTDepositPool.sol#L109
https://github.com/code-423n4/2023-11-kelp/blob/c5fdc2e62c5e1d78769f44d6e34a6fb9e40c00f0/src/LRTOracle.sol#L46
https://github.com/code-423n4/2023-11-kelp/blob/c5fdc2e62c5e1d78769f44d6e34a6fb9e40c00f0/src/LRTOracle.sol#L68
Vulnerability details
Summary
The usage of the
latestAnswer
function from the Chainlink library has been deprecated according to Chainlink’s documentation. This function, if no response is available, does not throw an error but returns a value of 0.The
getAssetPrice()
function calls the deprecated latestAnswer function, potentially resulting in incorrect price data for various feeds or leading to a division by zero and possibly a Denial of Service vulnerability.Impact
The affected functions, are
getRsETHAmountToMint()
andgetRSETHPrice()
.In getRsETHAmountToMint(), if getAssetPrice() returns 0:
If
getRSETHPrice()
also returns 0, it leads to a Denial of Service due to division by zero.If
getRSETHPrice()
does not return 0, rsethAmountToMint becomes zero, meaning the user receives no share despite depositing an asset.Tools Used
Manual review
Recommendations
To mitigate this risk, it is advisable to transition from using latestAnswer to latestRoundData. Additionally, incorporate checks on the return data and add error handling if the price is outdated or the round is incomplete:
This will ensure a more robust and updated handling of price data, avoiding stale or incomplete responses and potential division by zero vulnerabilities.
Assessed type
Oracle
The text was updated successfully, but these errors were encountered: