Summary:
The verifyPeriodByStateRoot
function in
ScrvusdVerifierV2.sol
lacks proper validation of the input block number, allowing attackers to use future or very old block numbers. This vulnerability could lead to manipulation of the oracle's price data and profit-unlocking schedules.
Vulnerability Details:
The vulnerable function:
The function accepts any block number without:
Checking if it's a future block.
Validating the age of the block.
Ensuring minimum intervals between updates.
Adding Reproducibility Section:
Impact:
Attackers can manipulate profit_max_unlock_time by providing future block numbers
Use of outdated state roots could lead to incorrect price data
Potential premature profit unlocking affecting vault economics
Oracle manipulation could impact all dependent protocols and pools
Critical for price stability in stableswap-ng pools
Impact Validation Section:
Scope Alignment:
The vulnerability directly impacts:
-ScrvusdOracleV2.vy - Main oracle contract
-Stableswap-ng pools using this oracle
-All contracts in contracts/scrvusd/ (explicitly in scope)
Attack Flow Diagram:
This vulnerability is particularly severe because:
-It affects core oracle functionality
-Impacts multiple downstream systems
-No existing safeguards
-Easy to exploit
-Direct financial impact through price manipulation
Tools Used:
-Manual code review
Recommendations:
Implement block number validation:
Add update frequency limits:
Implement event emission for better monitoring:
These changes will ensure the oracle maintains accurate and timely price data while preventing manipulation through block number attacks.
- 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.