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

Lack of Proper Validation in _extractParametersFromProof()

Summary

The function _extractParametersFromProof() in ScrvusdVerifierV1.sol assumes that the length of proofs is exactly PROOF_CNT but does not validate the contents of the proofs. If the proofs contain invalid or manipulated data, the function may extract and use incorrect parameter values, leading to potential incorrect price updates.

Vulnerability Details

  • Assumption Without Verification: The function assumes that all proofs contain valid data without verifying their correctness beyond length checking.

  • Potential Manipulation: Attackers could craft malformed proofs that pass length validation but contain incorrect slot values.

  • Price Manipulation Risk: The function feeds the extracted values into _updatePrice(), meaning incorrect parameters could alter the price oracle’s reported values.

Impact

This vulnerability allows an attacker to provide a malformed proof that:

  1. Introduces incorrect parameter values.

  2. Causes the oracle to update prices with manipulated data.

  3. Potentially disrupts financial calculations dependent on accurate oracle prices.

The Vulnerable Code

function _extractParametersFromProof(
bytes32 stateRoot,
bytes memory proofRlp
) internal view returns (uint256[PARAM_CNT] memory) {
RLPReader.RLPItem[] memory proofs = proofRlp.toRlpItem().toList();
require(proofs.length == PROOF_CNT, "Invalid number of proofs");
// 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;
}

Tools Used

Manual Code Review

Recommendations

  1. Validate Proof Contents: Ensure each proof contains valid, expected data before using it.

  2. Implement Additional Verification: Compare extracted values against expected ranges or historical trends.

  3. Require Additional Signatures or Multi-Source Verification: Use multiple oracles to cross-verify prices before updating.

Updates

Lead Judging Commences

0xnevi Lead Judge
3 months ago
0xnevi Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope
Assigned finding tags:

[invalid] finding-missing-proof-content-validation

- See [here]([https://github.com/CodeHawks-Contests/2025-03-curve?tab=readme-ov-file#blockhash-oracle)](https://github.com/CodeHawks-Contests/2025-03-curve?tab=readme-ov-file#blockhash-oracle) on how it is used to verify storage variable - All state roots and proofs must be verified by the OOS `StateProofVerifier` inherited as `Verifier` (where the price values and params are extracted), so there is no proof that manipulating timestamp/inputs can affect a price update - It is assumed that the OOS prover will provide accurate data and the OOS verifier will verify the prices/max unlock time to be within an appropriate bound/values - There is a account existance check in L96 of `ScrvusdVerifierV1.sol`, in which the params for price updates are extracted from

Support

FAQs

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