The ScrvusdVerifierV1 contract extracts key financial parameters from state proofs and uses them to update the price of scrvUSD through an oracle. However, the implementation fails to validate whether each storage slot proof actually exists before accepting its value. As a result, zero values can be inadvertently or maliciously introduced into the oracle’s price calculation, potentially distorting prices and allowing for manipulative attacks on dependent liquidity pools.
In the _extractParametersFromProof() function, the contract processes an array of Merkle Patricia Trie (MPT) proofs and extracts storage slot values corresponding to critical scrvUSD vault parameters such as total_debt, total_idle, totalSupply, and last_profit_update. The function uses Verifier.extractSlotValueFromProof() to obtain a SlotValue struct (presumably containing a value and an exists flag). However, the contract whether the exists flag is false, and the slot's value (which defaults to 0 when the slot doesn't exist) to the params array without any validation.
The code section in question;
This oversight allows proofs that omit valid slot values to pass unchecked, resulting in potentially zeroed parameters being submitted to the oracle’s update_price() function. Since the oracle pricing relies on these parameters, feeding it incorrect values—especially zeros—could lead to inaccurate price updates.
Manual Review
After extracting each SlotValue from the proof, explicitly check the exists flag
- Looking at the OOS `StateProofVerifier` and `MerklePatriciaProofVerifier` contract that extracts the slot, the `exists` flag will be flagged as true as long as a non-zero length value is returned as seen [here](https://github.com/curvefi/curve-xdao/blob/3ff77bd2ccc9c88d50ee42d2a746fc7648c7ff2c/contracts/libs/StateProofVerifier.sol#L133C13-L136). From the `MerklePatriciaProofVerifier.extractProofValue`, the minimum length returned will be 1 as represenetd by `bytes(0)`. So this seems to be purely a sanity check that might not even be required. - A slot with zero values is only allowed when the proof provided by the prover correctly proofs that such values are included within the Merkle-Patricia-Tree. The values fetched from mainnet from the V3Vault stored in the merkle trie is likely checked before hand and aggregated into the MerkleTree.
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.