The _extractPeriodFromProof()
function in ScrvusdVerifierV2.sol
only verifies that slot.exists
is true but does not perform any validation on slot.value
. This lack of explicit validity checks could allow an attacker to manipulate the profit unlock time by submitting a crafted proof that tricks the function into accepting a manipulated period value.
The function _extractPeriodFromProof()
is responsible for extracting a period value from a state proof using a given state root. However, it only checks for the existence of the slot but does not validate the extracted value:
Here, require(slot.exists);
ensures that the slot exists but does not verify if slot.value
is within an expected range. If an attacker manages to submit a proof that makes slot.exists
return true
while setting an arbitrary slot.value
, they could manipulate profit unlock times.
An attacker could submit a manipulated proof to delay or accelerate the profit unlock time.
This could be exploited to manipulate financial parameters in the protocol, potentially leading to unfair advantages or financial losses.
Manual code review
Static analysis tools for Solidity security
2.Add Range Checks: Ensure that slot.value
falls within a reasonable range.
2.Verify Against Historical Data: Compare slot.value
against previously stored values to detect anomalies.
3.Enhance Proof Validation: Introduce additional verification mechanisms to confirm the legitimacy of the extracted period value.
- 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.