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

Mutable Declaration of PERIOD_SLOT Leading to Potential Inaccurate Slot Access

Details:
The PERIOD_SLOT variable in the ScrvusdVerifierV2 contract is declared as an internal mutable state variable instead of a constant or immutable value. While no function currently exists that can alter this variable, its mutability leaves room for accidental changes in future code modifications or in derived contracts. If PERIOD_SLOT is modified, the contract may extract data from an incorrect storage slot, potentially leading to misinterpretation of the profit unlocking parameters.

Root Cause:
The variable was declared as a mutable internal state variable (uint256 internal PERIOD_SLOT = 37;) instead of using the constant or immutable keyword. This choice increases the risk of its value being inadvertently changed in future contract extensions or via inheritance.

Impact:
If PERIOD_SLOT is inadvertently modified, the extraction of the period value from the state proof could be based on an incorrect slot hash. This can lead to an incorrect value being used in the profit unlocking logic, potentially causing malfunctions in updating the oracle state or misrepresenting the contract’s internal state.

Recommendation:
Change the declaration of PERIOD_SLOT to use the constant keyword (or immutable if its value were to be set in the constructor) to prevent any modifications. This will enforce that the value remains fixed at compile time, thereby mitigating the risk of unintended modifications in the future.

Proof of Concept:
Consider a derived contract or future modification where PERIOD_SLOT is inadvertently updated:

contract MaliciousVerifier is ScrvusdVerifierV2 {
// Accidental override or state modification
function modifyPeriodSlot(uint256 newSlot) external {
// This function would be possible if PERIOD_SLOT remained mutable.
PERIOD_SLOT = newSlot;
}
}

In this scenario, an attacker or a flawed upgrade could change PERIOD_SLOT, causing the contract to extract slot values from an unintended storage location, leading to misbehavior in the period verification process. Using a constant would prevent such modifications entirely.

Updates

Lead Judging Commences

0xnevi Lead Judge
3 months ago
0xnevi Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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