Severity: High
The LevelOne contract's graduateAndUpgrade function lacks a critical validation to ensure that the educational session has properly concluded before allowing system graduation and upgrade. This omission enables the principal to prematurely end an academic session, distribute funds, and upgrade the system before the intended 4-week duration has elapsed.
When a session is initiated through the startSession function, a sessionEnd timestamp is set 4 weeks into the future:
However, the graduateAndUpgrade function, which handles the critical operations of system upgrade and fund distribution, fails to verify that this session has actually reached its intended conclusion:
The function is missing a check similar to:
This vulnerability has several serious implications:
Contractual Violation: Students pay school fees with the expectation of receiving a full 4-week educational term, but this can be arbitrarily shortened.
Premature Fund Distribution: Teachers and principal can receive their share of the funds without fulfilling the complete term of service.
Incomplete Educational Assessment: The system may graduate students before they have received sufficient reviews or before their final scores accurately reflect their performance.
System State Inconsistency: After graduation, the inSession flag is not reset, leaving the system in an ambiguous state where it technically remains "in session" after graduation.
Cutoff Score Bypass: Students who haven't met the established cutOffScore might be graduated prematurely, bypassing this quality control measure.
The graduateAndUpgrade function in LevelOne:
Principal calls startSession setting sessionEnd to be 4 weeks in the future
Shortly after (e.g., 1 day later), principal calls graduateAndUpgrade
The function executes successfully, distributing funds to teachers and principal
Students have only received 1 day of education instead of the promised 4 weeks
The system upgrades to _levelTwo prematurely
Add a timestamp validation to ensure the session has properly concluded:
Reset the session state to maintain system consistency:
Consider implementing a check for the cutoff score criteria:
`graduateAndUpgrade()` can be called successfully even when the school session has not ended
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.