The graduateAndUpgrade function in LevelOne.sol does not check whether all students have received exactly 4 reviews before upgrading the system, violating the project's invariant that system upgrades should not occur if any student has not received 4 reviews (one per week).
According to the project invariants, students must have received all 4 reviews (one for each week) before the system can be upgraded. However, the graduateAndUpgrade function does not verify the reviewCount for each student in listOfStudents. This allows the principal to upgrade the system even if some students have fewer than 4 reviews, bypassing the required review process.
Relevant code in graduateAndUpgrade:
No condition checks reviewCount[_student] == 4 for each student, violating the invariant.
Impact: High
This vulnerability severely disrupts protocol functionality by allowing the system to upgrade without ensuring all students have completed their required 4 reviews. This can lead to unfair graduation outcomes, as students with incomplete reviews may be incorrectly evaluated or upgraded, undermining the protocol's core logic and fairness. No direct financial loss occurs, but the integrity of the system is significantly compromised.
Likelihood: Medium
Exploitation depends on the principal calling graduateAndUpgrade before all students have received 4 reviews, which could happen intentionally or due to an error. The likelihood is moderate, as it requires specific conditions (e.g., incomplete reviews) but is feasible during normal operation.
Manual code analysis
Add a check to ensure all students have received exactly 4 reviews before allowing the upgrade. Suggested code modification:
This ensures the upgrade adheres to the invariant that all students must have 4 reviews.
All students are graduated when the graduation function is called as the cut-off criteria is not applied.
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.