Missing price feed validation in oracle contract
The Oracle contract's _getLastPrice function retrieves price data from oracle price feeds without performing critical validation checks, which could lead to stale or invalid price data being used in the protocol.
Severity
Impact: Medium
Likelihood: Medium
Description
The Oracle contract's _getLastPrice function retrieves price data from oracle price feeds without performing critical validation checks, which could lead to stale or invalid price data being used in the protocol.
function _getLastPrice(address token) internal view returns (uint256 price, uint256 timestamp) {(, int256 answer, /* uint256 startedAt */, uint256 updatedAt,) = tokenOracle[token].latestRoundData();price = answer.toUint256();timestamp = updatedAt;}
This vulnerability exists in the following areas:
- Staleness Check:
- The function does not verify if the price data is fresh by comparing the
updatedAttimestamp with the currentblock.timestamp. - Stale price data could be used for critical protocol operations.
- The function does not verify if the price data is fresh by comparing the
- Price Validity:
- No validation of the answer value to ensure it's not going to go below
minAnswerdefined by thebreaker.
- No validation of the answer value to ensure it's not going to go below
- L2-Specific Concerns:
- When deployed on L2 networks, the contract lacks sequencer uptime validation (To be validated).
Recommendations
Implement comprehensive price feed validation in the _getLastPrice function.
Report provenance
Published by Pashov Audit Group, with Carlos (Bloqarl) participating as a contractor. The source report states that its fixes review was not fully completed; no final remediation disposition is recorded for this finding. Read the full report.