The ChainlinkOracle.sol
contract fails to validate Chainlink's circuit breaker bounds (minAnswer
/maxAnswer
) when fetching price data. Chainlink feeds have built-in minimum and maximum price thresholds, and when an asset's price moves beyond these bounds, the oracle returns these threshold values instead of the actual market price.
Current implementation:
The function only validates that the price is greater than zero but doesn't check if the Chainlink circuit breaker has been triggered. This is particularly dangerous because:
The returned price is used for AMM weight adjustments
The price undergoes normalization which could amplify the issue
The normalized price is then cast to int216 without additional bounds checking
If an asset experiences extreme price movements (like the LUNA crash), the oracle will return minAnswer
or maxAnswer
instead of the true market price. This could lead to:
Incorrect Pool Weights: The AMM could maintain incorrect weights based on stale threshold prices
Mispriced Trades: Users could execute trades at incorrect prices if the real market price is beyond the bounds
Amplified Issues: The normalization factor (10 ** normalizationFactor) could amplify the price discrepancy
Real-world precedent:
Venus Protocol lost $11M during the LUNA crash due to Chainlink's circuit breaker returning minimum price instead of the actual crashed price
Similar issues have been identified in audits of Euler Finance and other protocols
Consider implementing any of these strategies:
Fallback Oracle System
Integrate a secondary price oracle (e.g., Uniswap TWAP)
Compare Chainlink price against the fallback oracle with a defined deviation threshold
If deviation exceeds threshold, use fallback price or pause weight adjustments
AMM-Specific Safeguards
Implement maximum weight adjustment limits per update
Add trade size restrictions that scale with price volatility
Consider temporary trading suspensions if price movements exceed certain thresholds
These solutions provide protection while:
Avoiding expensive on-chain minAnswer/maxAnswer validations
Maintaining protocol functionality during normal market conditions
Gracefully handling extreme market events
Preserving gas efficiency for normal operations
LightChaser: ## [Low-25] Chainlink answer is not compared against min/max values
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.