The update_price
function in ScrvusdOracleV2.vy
does not validate the logical consistency of the parameters it receives. This allows a malicious prover to submit mismatched values (e.g., total_idle + total_debt != total_supply
), leading to incorrect price calculations and potential manipulation of the oracle.
The update_price
function accepts an array of parameters (_parameters
) that represent key metrics of the scrvUSD vault, such as total_debt
, total_idle
, and total_supply
. These parameters are used to calculate the price of scrvUSD. However, the function does not verify that these parameters are logically consistent.
total_assets
should equal total_idle + total_debt
.
total_supply
should equal total_assets
Add this function to tests/scrvusd/oracle/unitary/test_v2.py:
Then run: pytest -s tests/scrvusd/oracle/unitary/test_v2.py
output:
The lack of validation in update_price has the following consequences:
Price Manipulation:
Attackers can submit inconsistent parameters to artificially inflate or deflate the price.
This could lead to arbitrage opportunities or draining of stableswap pools.
System-Wide Impact:
The flaw affects all integrations relying on the oracle, potentially breaking the economic assumptions of the entire ecosystem.
it can only be called by a trusted verifier.
Add Validation in update_price
:
Enforce the following invariants:
total_assets == total_idle + total_debt
total_supply == total_assets
Revert the transaction if these conditions are not met.
- See [here]([https://github.com/CodeHawks-Contests/2025-03-curve?tab=readme-ov-file#blockhash-oracle)](https://github.com/CodeHawks-Contests/2025-03-curve?tab=readme-ov-file#blockhash-oracle) on how it is used to verify storage variable - All state roots and proofs must be verified by the OOS `StateProofVerifier` inherited as `Verifier` (where the price values and params are extracted), so there is no proof that manipulating timestamp/inputs can affect a price update - It is assumed that the OOS prover will provide accurate data and the OOS verifier will verify the prices/max unlock time to be within an appropriate bound/values - There is a account existance check in L96 of `ScrvusdVerifierV1.sol`, in which the params for price updates are extracted from
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.