Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

Storage Layout Mismatch Between LevelOne and LevelTwo

Summary

The LevelTwo contract introduces state variables in an incompatible order with LevelOne, risking storage collisions during upgrades.

Vulnerability Details

When upgrading from LevelOne to LevelTwo, the storage layout differs. For example:

  • LevelOne has schoolFees as the third variable, while LevelTwo replaces it with sessionEnd.

  • LevelTwo omits variables like reviewCount and lastReviewTime.

This mismatch causes critical variables (e.g., principal, bursary) to reference incorrect storage slots, leading to data corruption.

Impact

Storage corruption could reset principal to a wrong address, lock funds, or break core functionalities like fee distribution.

Tools Used

Recommendations

Maintain identical storage layouts between upgraded contracts. Use @openzeppelin/contracts-upgradeable’s StorageGap pattern to reserve slots for future variables.

Updates

Lead Judging Commences

yeahchibyke Lead Judge 18 days ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
yeahchibyke Lead Judge 18 days ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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