The ScrvusdVerifierV1.sol
and ScrvusdVerifierV2.sol
contracts lack access control mechanisms for all price and period update functions. This vulnerability undermines the carefully implemented role-based access control system in the oracle contract (ScrvusdOracleV2.vy
), allowing any external actor to call these functions and potentially manipulate critical protocol parameters.
Severity: High
Files Affected:
contracts/scrvusd/verifiers/ScrvusdVerifierV1.sol
contracts/scrvusd/verifiers/ScrvusdVerifierV2.sol
Functions Affected:
verifyScrvusdByBlockHash()
verifyScrvusdByStateRoot()
verifyPeriodByBlockHash()
verifyPeriodByStateRoot()
All four verification functions are defined with the external
visibility modifier but lack any access control mechanisms:
This is particularly problematic because the oracle contract (ScrvusdOracleV2.vy
) implements a proper role-based access control system:
The oracle expects that only approved verifiers with specific roles can call its update functions. However, because the verifier contracts themselves lack access control, anyone can trigger these updates by calling the verifier functions, completely bypassing the oracle's security model.
The lack of access control on these critical functions has severe implications:
Circumvention of Oracle's Security Model: The carefully designed role-based access control in the oracle is rendered ineffective since anyone can call the verifier contracts.
Price Manipulation: Unauthorized actors can trigger price updates at strategically chosen times by selectively submitting proofs from specific blocks where the scrvUSD parameters would result in favorable price movements.
Economic Exploitation: An attacker could monitor the chain for moments when parameters would cause advantageous price or period updates, then exploit these moments for financial gain through other protocol interactions.
Timestamp Manipulation: This vulnerability compounds with the oracle's acceptance of user-provided timestamps, allowing attackers to potentially influence price calculations with manipulated timestamps.
Oracle Reliability Compromise: The reliability of price data is fundamental to DeFi protocols. Unrestricted access to update functions undermines this reliability and could lead to cascading failures in dependent systems.
Manual code review
Implement Role-Based Access Control in Verifier Contracts:
Integrate OpenZeppelin's AccessControl library to limit function access to authorized entities.
Ensure the same roles enforced in the oracle are also enforced in the verifiers.
Grant Roles to Appropriate Entities:
Ensure that only trusted entities (like authorized bots or governance) have the required roles.
Implement a proper role administration system to manage these permissions.
Time-Based Update Restrictions:
Implement cooldown periods between updates to prevent rapid manipulation.
Event Emission for Auditing:
Add events for all parameter updates to facilitate off-chain monitoring.
By implementing these recommendations, particularly the role-based access control that aligns with the oracle's security model, the contracts would significantly improve their security posture and prevent unauthorized manipulation of critical protocol parameters.
Invalid, all state roots and proofs must be verified by the OOS `StateProofVerifier` inherited as `Verifier`, so there is no proof that a permisionless `verify`functions allow updating malicious prices
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.