Oracle functions mislead integrators as it is not compatible with Chainlink Price feed behaviour
Spectra's oracles implement the Chainlink AggregatorV3Interface but do not behave like a real Chainlink price feed: getRoundData ignores the roundId and returns the same data as latestRoundData, and the roundId, startedAt, updatedAt and answeredInRound fields are always zero. Integrators who follow Chainlink's guidance would treat the returned price as invalid and could be misled about historical rounds.
Originally disclosed on Immunefi
- Disclosed after under an hour
#43314 [SC-Insight] Oracle functions mislead integrators as it is not compatible with Chainlink Price feed behaviour
Submitted on Apr 4th 2025 at 14:14:13 UTC by @holydevoti0n for Audit Comp | Spectra Finance
- Report ID: #43314
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/immunefi-team/Spectra-Audit-Competition/blob/main/src/spectra-oracles/oracles/BaseOracleCurveLPT.sol
- Impacts:
Description
Vulnerability Details
All the new oracles from Spectra inherits from AggregatorV3Interface which is the Chainlink interface for price feeds. Problem is all oracles from Spectra that implement this interface do not behave as expected for a Chainlink Price Feed Integration.
First issue is:
- The
getRoundDataandlatestRoundDatawill always return the same data, asgetRoundDatacompletely ignores theroundIdpassed as a parameter. Proof here: https://github.com/immunefi-team/Spectra-Audit-Competition/blob/1cebdc67a9276fd87105d13f302fd77d000d0c0b/src/spectra-oracles/oracles/BaseOracle.sol#L46
function getRoundData(
uint80
)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
)
{ // @audit - `latestRoundData` return same output, regardless of the input passed in `getRoundData`
@> return (0, int256(_getQuoteAmount()), 0, 0, 0);
}
/** @dev See {AggregatorV3Interface-latestRoundData}. */
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
)
{ // @audit - `latestRoundData` and `getRoundData` return same output, regardless of the input passed in `getRoundData`
@> return (0, int256(_getQuoteAmount()), 0, 0, 0);
}
- Second issue is that: the returned variables
roundId,startedAt,updatedAtandansweredInRoundare always zero. Integrators use those variables to check whether the current price is still valid. As Spectra always returns those variables with the value0, this means the current price being returned is INVALID.
You can see this is the Chainlink recommendation for consuming valid price from the price feed oracles: https://docs.chain.link/data-feeds#check-the-timestamp-of-the-latest-answer
So Spectra implements Chainlink Price Feed interface for an oracle that do not reflect the Chainlink Implementation's behaviour.
Impact Details
- The current implementation always returns an "invalid price" according to Chainlink, which will mislead integrators to avoid using Spectra's oracles.
getRoundDatawill mislead integrators that wants to check specific rounds for prices as this function works exactly aslatestRoundDatareturning the latest price.
Recommendation
Spectra should not use AggregatorV3Interface to its oracles as they are not reflecting a Chainlink Price Feed.
Spectra should create a specific interface based on its current implementation and remove the Chainlink functions completely.
Proof of Concept
Proof of Concept
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 oracle reused the Chainlink AggregatorV3Interface without implementing its round and timestamp semantics, returning hardcoded zeros and ignoring the roundId argument.
Impact
Integrators following Chainlink's guidance would see the price as invalid and may avoid Spectra's oracles, and getRoundData could mislead anyone trying to read a specific historical round.
What the attacker needed
Integrator consumes the oracle via Chainlink interface
The fix
Spectra should stop using AggregatorV3Interface and define its own interface matching its actual behaviour, removing the Chainlink functions.
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 price oracle is a contract that tells other contracts what an asset is worth. Many projects expect oracles to follow Chainlink's standard interface, which includes extra fields such as when the price was last updated. Here the oracle uses that standard interface but fills those fields with zeros and ignores the requested round, so anyone relying on the standard checks would think the price is stale or invalid.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.