A critical vulnerability has been identified in the ScrvusdVerifierV2
contract's _extractPeriodFromProof
function. The function incorrectly attempts to access the profit_max_unlock_time
storage variable from the scrvUSD contract by using an invalid storage slot hash calculation method. This error would cause state proof verification to fail, rendering the contract's core functionality unusable.
The affected code is in the _extractPeriodFromProof
function:
The vulnerability is in this line:
The vulnerability prevents accurate verification of state proofs for the profit_max_unlock_time
parameter. When the contract attempts to verify a proof using this incorrect slot calculation, the Merkle proof validation will fail even with correctly constructed proofs. This failure occurs because the calculated storage slot hash doesn't correspond to the actual storage location of the profit_max_unlock_time
variable in the scrvUSD contract's storage trie.
The impact propagates through the verification workflow, causing all calls to verifyPeriodByBlockHash
and verifyPeriodByStateRoot
to revert when they attempt to validate submitted proofs. Consequently, the system becomes unable to process valid updates to the critical profit max unlock time parameter, effectively disabling the core functionality of the ScrvusdVerifierV2 contract in the protocol's oracle system.
The vulnerability stems from a misunderstanding of how Ethereum storage slots are accessed:
For direct storage variables at fixed slots (like slot 37), a simple conversion from the slot number to bytes32 is required
The current implementation incorrectly applies a keccak256 hash to the slot number
The abi.encode()
function adds additional encoding that further modifies the resulting hash
Replace the incorrect storage slot calculation with the correct approach:
The corrected function should look like:
Additionally, verify that the slot number (37) is indeed correct for accessing profit_max_unlock_time
in the scrvUSD contract, as Vyper's storage layout may differ from Solidity's.
See primary comments in issue #23
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.