In the LevelOne.sol contract, the reviewCount mapping is used to track how many reviews each student has received, which is critical for enforcing the invariant that "Students must have gotten all reviews before system upgrade." This mapping is declared as:
The vulnerability arises because when a student enrolls through the enroll() function, their reviewCount value is never explicitly initialized. While Solidity automatically initializes state variables to default values (0 for uint256), this implicit initialization creates several security and maintainability issues.
Improper Tracking: The giveReview() function checks if a student has received fewer than 5 reviews
But it never increments the counter after giving a review, rendering this check ineffective.
Missing Explicit Initialization: The enroll() function sets several student properties but fails to explicitly initialize reviewCount:
Graduation Validation Gap: There is no mechanism to verify that students have received exactly 4 reviews before the system upgrade, breaking a key invariant.
This vulnerability impacts the integrity of the review system in several ways:
Students could potentially receive more than the allowed number of reviews
The graduation process lacks validation that students have completed all required reviews
The system fails to properly track educational progress
Core business logic that relies on accurate review counting is compromised
While this vulnerability doesn't directly result in fund loss, it breaks a fundamental invariant of the educational system, potentially allowing students to graduate without proper assessment or causing some students to be unfairly treated.
manual review
Slither & Aderyn tools used
Explicitly initialize the reviewCount variable in the enroll() function:
Increment the review count in the giveReview() function:
Add validation in the graduateAndUpgrade() function to ensure all students have received exactly 4 reviews:
`reviewCount` for students is not updated after each review session
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.