Severity: High
Category: Mathematical/Logic Error
Impact: Artificially inflated price calculations that can lead to pool draining
Likelihood: High for extended time projections
Contract: ScrvusdOracleV2.vy
Function: _obtain_price_params
The _obtain_price_params
function progressively reduces total_supply
in each iteration of the loop without proper bounds or sanity checks. With each period, the total_supply
is reduced by (params.balance_of_self * params.balance_of_self // params.total_supply)
, which can cause it to decrease exponentially over multiple periods.
Over extended projection periods, the total_supply
can become very small
When _raw_price
later calculates self._total_assets(parameters) * 10**18 // self._total_supply(parameters, ts)
, the diminished denominator causes an artificially inflated price
An attacker can exploit the inaccurate price by trading against the pool that relies on this oracle
The pool can be drained through arbitrage due to the mispricing, causing significant loss to liquidity providers
Implement a hard minimum cap on total_supply
to prevent division by very small numbers
Reduce max_v2_duration
significantly to limit the compounding effect
Use a different mathematical model that doesn't reduce the supply exponentially
Impact: High - The vulnerability can lead to drastically incorrect price calculations, enabling malicious actors to drain pools relying on this oracle. As stated in the README: "If not precise enough, this can lead to MEV in the liquidity pool, at a loss for the liquidity providers. Even worse, if someone is able to manipulate this rate, it can lead to the pool being drained from one side."
Likelihood: High - The issue will manifest deterministically when projecting prices for longer durations, which is exactly what the price_v2 function is designed to do.
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.