Skip to content
Smart contracts Audit finding Intermediate

Chainlink pricer is using a deprecated API

The price oracle contract used Chainlink's deprecated latestAnswer function to fetch asset prices. If Chainlink stops supporting that API or returns stale data, the contract could receive an outdated or failing price feed.

cccz Follow

Originally disclosed on Code4rena

Submitted by cccz, also found by 0x1f8b, 0xDjango, 0xNazgul, GimelSec, hake, IllIllI, kebabsec, oyc_109, Ruhum, sorrynotsorry, throttle, and tintin

According to Chainlink’s documentation, the latestAnswer function is deprecated. This function might suddenly stop working if Chainlink stop supporting deprecated APIs. And the old API can return stale data.

Proof of Concept

PriceOracleImplementation.sol#L29-L30

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 https://docs.chain.link/docs/price-feeds-api-reference/

bunkerfinance-dev (bunker.finance) confirmed


The original report as published on Code4rena, by cccz. 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 contract relied on a deprecated oracle function that returns a single value without freshness or round-completion checks.

Impact

The oracle could return stale prices or stop working entirely, which may lead to incorrect pricing in the protocol.

What the attacker needed

Protocol relies on Chainlink price feeds

The fix

The contract should use latestRoundData and check that the returned price is fresh and the round is complete, reverting with a clear message otherwise.

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 often needs to know the current price of an asset, so it asks an outside service called an oracle. This contract asked the oracle using an old, deprecated way of requesting the price, which may stop working or give an out-of-date answer. If the price is wrong, anything that depends on it, such as loans or trades, can be calculated incorrectly.

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 cccz

View all

104 more disclosed reports, best first.

More from bunker.finance contest

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.