Skip to content
Smart contracts Audit finding Intermediate

Use of deprecated Chainlink function latestAnswer

The smart contract used the deprecated Chainlink latestAnswer function, which returns 0 if no answer is available, potentially feeding an incorrect price to the Buoy3Pool. This could cause deposits and withdrawals to stop, halting the protocol.

shw Follow

Originally disclosed on Code4rena

Submitted by shw

According to Chainlink’s documentation (Deprecated API Reference, Migration Instructions, and API Reference), the latestAnswer function is deprecated. This function does not throw an error if no answer has been reached, but instead returns 0, causing an incorrect price to be fed to the Buoy3Pool. See Buoy3Pool.sol L207 and L214-L216.

Recommend using the latestRoundData function to get the price instead. Also recommend adding checks on the return data with proper revert messages if the price is stale or the round is incomplete, for example:

(uint80 roundID, int256 price, , uint256 timeStamp, uint80 answeredInRound) = oracle.latestRoundData();
require(answeredInRound >= roundID, "...");
require(timeStamp != 0, "...");

kristian-gro (Gro) disagreed with severity:

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

kristian-gro (Gro) confirmed:

Confirmed and shares have been removed from release version.

ghoul-sol (Judge) commented:

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.

The original report as published on Code4rena, by shw. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the use of the deprecated latestAnswer function, which returns 0 instead of reverting when no answer is available, without checks for stale or incomplete rounds.

Impact

Deposits and withdrawals could stop, halting the protocol, but no funds are lost.

What the attacker needed

None

The fix

The project removed the affected shares from the release version, and the recommendation is to use latestRoundData with checks for stale or incomplete rounds.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract relied on an old way to get price data from Chainlink, which can return zero when no price is available. That zero price could break the pool's calculations and stop people from depositing or withdrawing.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by shw

View all

22 more disclosed reports, best first.

More from Gro Protocol

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.