DeFiLayer 1Layer 2
14,723 OP
View results
Submission Details
Severity: high
Invalid

Incorrect Slot Lookup in ScrvusdVerifierV1.sol

Summary

In ScrvusdVerifierV1.sol file

PARAM_SLOTS is defined with incorrect slot lookup.

Vulnerability Details

In ScrvusdVerifierV1.sol file

uint256[PROOF_CNT] internal PARAM_SLOTS = [
uint256(0), // filler for account proof
uint256(21), // total_debt
uint256(22), // total_idle
uint256(20), // totalSupply
uint256(38), // full_profit_unlock_date
uint256(39), // profit_unlocking_rate
uint256(40), // last_profit_update
uint256(keccak256(abi.encode(18, SCRVUSD))) // balanceOf(self)
];

In uint256(keccak256(abi.encode(18, SCRVUSD)))

Solidity computes the storage slot of balanceOf[address] as:

keccak256(abi.encode(address, slot_index))

But in the contract, used keccak256(abi.encode(slot_index, address))

Impact

The extracted value for balanceOf(SCRVUSD) is incorrect.

This incorrect value is passed to the IScrvusdOracle.update_price() function, leading to:

  • Incorrect price calculations.

  • Potential manipulation of the scrvUSD price.

Tools Used

Manual

Recommendations

Need to modify as following.

uint256(keccak256(abi.encode(SCRVUSD, 18)))

Updates

Lead Judging Commences

0xnevi Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

[invalid] finding-ScrvusdVerifierV1-incorrect-storage-slot-balanceOf-compute

- Per sponsor comments, verified slot is vyper, solidity contract only verifies it. - Vyper computes storage slots different from solidity as seen [here](https://ethereum.stackexchange.com/questions/149311/storage-collision-in-vyper-hashmap)

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.