Skip to content
Smart contracts Audit finding Intermediate

Should check return data from Chainlink aggregators

The contract read the ETH price from a Chainlink aggregator without checking the round ID or timestamp, so it could act on a stale or incomplete price. An attacker or unlucky timing could then cause the contract to use an outdated ether price, putting funds at risk.

FairSide contest

Originally disclosed on Code4rena

The getEtherPrice function in the contract FSDNetwork fetches the ETH price from a Chainlink aggregator using the latestRoundData function. However, there are no checks on roundID nor timeStamp, resulting in stale prices.

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) = ETH_CHAINLINK.latestRoundData();
require(answeredInRound >= roundID, "...");
require(timeStamp != 0, "...");

fairside-core (FairSide) confirmed:

Fixed in PR#7.

cemozerr (Judge) commented:

Labeling this as medium risk as stale ether price could put funds at risk.

The original report as published on Code4rena. 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

The contract consumed the oracle's latest round data without validating that the round was complete and the timestamp was non-zero.

Impact

A stale ether price could put funds at risk, which the judge rated as medium risk.

What the attacker needed

Contract reads a Chainlink price feed

The fix

The return data should be checked, reverting with a clear message when the round is incomplete or the price is stale; the project says it was fixed in a pull request.

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 asks an outside service, called an oracle, for a price such as the value of ether. This contract never checked whether the answer it got back was fresh or complete, so it could use an old price. Using an old price can make the contract pay out or accept the wrong amount, which risks the money it holds.

What is Smart contracts?

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

More from FairSide 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.