Skip to content
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 #126

Open
code423n4 opened this issue Jul 10, 2021 · 2 comments
Open

Use of deprecated Chainlink function latestAnswer #126

code423n4 opened this issue Jul 10, 2021 · 2 comments
Labels

Comments

@code423n4
Copy link
Contributor

Handle

shw

Vulnerability details

Impact

According to Chainlink's documentation, the latestAnswer function is deprecated. This function does not error if no answer has been reached but returns 0, causing an incorrect price fed to the Buoy3Pool.

Proof of Concept

Referenced code:
Buoy3Pool.sol#L207
Buoy3Pool.sol#L214-L216

Referenced documentation:
Chainlink - Deprecated API Reference
Chainlink - Migration Instructions
Chainlink - API Reference

Recommended Mitigation Steps

Use the latestRoundData function to get the price instead. Add checks on the return data with proper revert messages if the price is stale or the round is uncomplete, for example:

(uint80 roundID, int256 price, , uint256 timeStamp, uint80 answeredInRound) = oracle.latestRoundData();
require(answeredInRound >= roundID, "...");
require(timeStamp != 0, "...");
@code423n4 code423n4 added 2 (Med Risk) bug Something isn't working labels Jul 10, 2021
code423n4 added a commit that referenced this issue Jul 10, 2021
@kitty-the-kat
Copy link
Collaborator

disagree with severity (Low risk)
Issue would cause deposits and withdrawals to stop, no funds lost

@ghoul-sol
Copy link
Collaborator

In my opinion halting the protocol deserves medium risk. While no funds are lost, from brand perspective it's a second worst thing. Keeping as medium risk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants