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

Missing Storage Slot Existence Checks in VerifierV1

Summary

The verifier fails to check if storage slots exist, risking incorrect parameter extraction

Vulnerability Details

In ScrvusdVerifierV1.sol, the _extractParametersFromProof loop assumes all storage slots (e.g., total_debt, total_idle) exist. Missing slots return 0, leading to invalid parameters.

// Extract account proof
Verifier.Account memory account = Verifier.extractAccountFromProof(
SCRVUSD_HASH,
stateRoot,
proofs[0].toList()
);
require(account.exists, "scrvUSD account does not exist");
// Extract slot values
uint256[PARAM_CNT] memory params;
for (uint256 i = 1; i < PROOF_CNT; i++) {
@> Verifier.SlotValue memory slot = Verifier.extractSlotValueFromProof(
@> keccak256(abi.encode(PARAM_SLOTS[i])),
account.storageRoot,
proofs[i].toList()
);
// Slots might not exist, but typically we just read them.
params[i - 1] = slot.value;
}
return params;
}

Impact

risking zero values for critical parameters.

Tools Used

Manual review, Slither.

Recommendations

// In ScrvusdVerifierV1.sol's _extractParametersFromProof
for (uint256 i = 1; i < PROOF_CNT; i++) {
Verifier.SlotValue memory slot = Verifier.extractSlotValueFromProof(...);
require(slot.exists, "Slot missing"); // Add this check
params[i - 1] = slot.value;
}
Updates

Lead Judging Commences

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

[invalid] finding-slot-not-check-verifierv1-v2

- 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.

Support

FAQs

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