According to the _getData function in the ChainlinkOracle.sol contract, its reliance on Chainlink oracles is undermined by two critical vulnerabilities: the absence of timestamp validation for price freshness and incomplete oracle health checks. These issues expose the contract to risks of using stale or invalid price data, potentially leading to financial losses, incorrect transactions, and exploitable conditions.
1. Outdated Price Data Usage
The _getData() function retrieves price data from a Chainlink oracle without validating the returned timestamp. This omission allows the contract to use stale price data, which can lead to incorrect decision-making in time-sensitive operations.
2. Incomplete Oracle Health Check
The contract only checks that price > 0 to validate the oracle data. However, it fails to verify additional critical metadata provided by Chainlink, such as roundID and answeredInRound. Neglecting these checks may result in accepting invalid or tampered data.
pkg/pool-quantamm/contracts/ChainlinkOracle.sol
Outdated Price Data Usage: Using stale data can severely impact the contract's financial calculations, potentially leading to significant financial losses, incorrect transactions, or exploitation by adversaries aware of the data's obsolescence.
Incomplete Oracle Health Check: Failing to perform comprehensive health checks increases the risk of accepting invalid or manipulated data, undermining the contract's reliability and exposing it to financial attacks or operational failures.
Manual Review
It is recommended to enforce a staleness period to ensure price data is recent before proceeding with critical operations, and verify additional metadata from the Chainlink oracle to ensure the data is valid and the oracle is healthy.
For example:
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.