The Verifier contracts (V1 and V2) rely on hardcoded storage slots to extract parameters from the scrvUSD contract. If the storage layout of the scrvUSD contract changes (e.g., due to upgrades or compiler optimizations), the Verifiers will read incorrect data, leading to invalid price calculations and potential oracle manipulation.
The Verifier contracts rely on hardcoded storage slots to extract parameters from the scrvUSD contract:
Solidity doesn't guarantee storage slot stability across contract upgrades or compiler versions
ScrvusdVerifierV1.sol defines PARAM_SLOTS
as fixed storage slots (e.g., total_debt
at slot 21, total_idle
at slot 22).
ScrvusdVerifierV2.sol assumes profit_max_unlock_time
is stored at slot 37.
If the scrvUSD contract’s storage layout changes (e.g., new variables are added, reordering occurs), these slots will point to unrelated data. e.g., if total_debt
moves to a different slot, the Verifier will read wrong values, causing the oracle to compute an incorrect price.
The oracle ends up being fed incorrect parameters, leading to manipulated scrvUSD
prices.
A malicious actor could exploit this to drain liquidity pools (e.g., arbitrage at incorrect rates) or destabilize the system.
Example: If total_supply
is read as 0 due to slot misalignment, the oracle’s _raw_price
will attempt division by zero, causing transaction reverts and denial-of-service.
Manual Review
Solc-select
Allow for dynamic configuration of storage slots via governance or admin functions instead of hardcoding them.
Implement a mechanism to validate the storage layout (e.g., checks against known hashes of the scrvUSD contract’s state variables).
Invalid, - srCRVUSD is a minimal proxy, meaning it can never by upgraded, see [here](https://www.cyfrin.io/blog/upgradeable-proxy-smart-contract-pattern#:~:text=Minimal%20proxies%20are%20distinct%20from,provide%20upgrade%20or%20authorization%20functionality.) and [here](https://www.rareskills.io/post/eip-1167-minimal-proxy-standard-with-initialization-clone-pattern) for more info. - Even if srcrvUSD is migrated in the future via a new minimal proxy contract deployment (which is highly unlikely), the verifier contracts can be migrated along with it via revoking the access-control within the `ScrvusdOracleV2.vy` and then granting access to a new oracle. This is also not within the scope of this contest.
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.