In the UpdateWeightRunner contract, when there is only one oracle available for an asset, the backup oracle validation loop is skipped entirely due to starting at index 1, allowing stale prices to be used without proper validation. This can lead to incorrect weight calculations and unfavorable trading conditions due to a stale price being used.
In the _getData function of UpdateWeightRunner.sol, if the primary oracle is stale there is a loop that checks backup oracles for stale data:
The issue occurs because:
The loop starts at index 1 since index 0 is meant to be the primary oracle
When numAssetOracles is 1 (only primary oracle available), the loop condition j < numAssetOracles is false immediately
This means no validation occurs on the primary oracle's data
With no other way to revert the function will always use the stale price in cases where there is only one oracle.
With arbitrary tokens and oracles being used alongside arbitrary staleness thresholds this is likley to occur at times. Combine that with weight updates being limited to once per interval, once this happens the pool will be unable to update until the next interval and funds will be at risk during this time.
Loss of funds. The use of stale oracle prices can lead to:
Incorrect weight updates allowing favorable arbitrage conditions
Mispriced assets during withdrawals impacting LP share values
Unfair swap prices benefiting traders at the expense of LPs
Manual Review
Revert if the primary oracle is stale and there is only one oracle.
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.