The ChainlinkOracle
and MultiHopOracle
contracts lack staleness checks when fetching oracle price data. This omission could allow the use of outdated or stale price data, leading to incorrect weight adjustments and mispricing in the AMM. The issue stems from the _getData()
function in both contracts, which retrieves and aggregates data without verifying its freshness.
ChainlinkOracle.sol:
Function: _getData()
Code snippet:
Issue: The function fetches price data using latestRoundData()
but does not check whether the timestamp
is within an acceptable range, allowing stale data to be used.
MultiHopOracle.sol:
Function: _getData()
Code snippet:
Issue: The function aggregates data from multiple oracles but does not perform staleness checks on the timestamps, potentially allowing outdated data to propagate.
The lack of staleness checks may expose the protocol to risks associated with outdated price feeds. For example:
If Chainlink experiences delays in consensus or system vulnerabilities, the latestRoundData()
function may return stale data.
If the timestamp is old, the returned price may no longer represent current market conditions.
Incorrect Pricing: Outdated prices can lead to significant mispricing in the AMM.
Risk of Exploitation: An attacker could exploit this weakness to manipulate the protocol’s pricing and weights.
Protocol Integrity: Using stale data undermines the integrity and reliability of the protocol.
Manual code review of the ChainlinkOracle.sol
and MultiHopOracle.sol
contracts.
Chainlink documentation to confirm behavior of latestRoundData()
.
Implement Staleness Checks:
Add a condition to verify that the timestamp
returned by latestRoundData()
is within a reasonable range (e.g., not older than 1 hour).
Example:
Validate Round IDs:
Ensure that the round ID corresponds to the latest completed round to prevent using outdated data.
LightChaser: ## [Medium-4] Insufficient oracle validation
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.