The linear price smoothing algorithm in ScrvusdOracleV2.vy can be manipulated to create predictable price movement patterns that could be exploited by attackers.
The problem is the predictability of price changes. Since:
The price change is purely linear, attackers can precisely predict the smoothed price movement.
No randomness is introduced in smoothing, meaning anyone can anticipate the exact price path.
The oracle uses a linear smoothing function to prevent sharp price changes:
Predictable Price Trajectory:
The _smoothed_price
function enforces a linear adjustment (max_change
) based on time since the last update. This creates a deterministic price path that can be calculated by attackers.
e.g., If raw_price
is 10% higher than the current smoothed price, the oracle will linearly increase its reported price at a predictable rate (governed by max_price_increment
).
This predictable smoothing allows sophisticated attackers to create arbitrage strategies that extract value from the liquidity pools that rely on this oracle, causing losses to liquidity providers.
A malicious actor could:
Trade against this known trajectory to extract value from the stableswap pool
Front-run or back-run transactions to maximize profit.
Consistently extract value from the price movement.
Manual Review
Instead of a linear function, consider implementing a price feed dampening mechanism that uses a time-weighted average price (TWAP) approach
This reduces predictability by dampening price movements over time.
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.