_getData
- Stale Oracle Data Can Be Accepted When There Are No Backups
In the _getData
function of the UpdateWeightRunner
contract, stale oracle data can be accepted when no backup oracles are configured. This can result in potentially incorrect weight adjustments based on outdated information.
The _getData
function retrieves oracle data for a pool. If the primary oracle returns stale data, and no backup oracles are configured, the function fails to revert and instead uses the stale data.
Here's the implementation of _getData
function:
When no backup oracles are configured, the for loop used for fallback validation is skipped, and the function does not revert. As a result, stale data from the primary oracle is used, even though it does not meet the freshness threshold.
Incorrect weight calculations: Using stale data may lead to inaccurate or inefficient weight updates.
Economic vulnerability: Pools may become misaligned with market prices, exposing them to manipulation or inefficiencies.
Security risks: If an oracle is intentionally manipulated to provide stale data, the pool could suffer financial loss.
Manual Review
Add a Revert Condition When No Backups Exist
Modify the _getData function to ensure it reverts if the primary oracle provides stale data and no backup oracles are configured. For example:
Encourage Backup Oracle Configuration
Update pool deployment documentation to recommend configuring backup oracles for every pool to avoid reliance on a single data source.
Introduce a Monitoring Mechanism
Develop a monitoring system to detect and alert administrators if pools are operating without backup oracles, ensuring prompt corrective action.
These measures will significantly reduce the risk of stale data being used in weight calculations, preserving the integrity and security of the protocol.
Cyfrin audit: 7.2.4 Stale Oracle prices accepted when no backup oracles available
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.