The graduateAndUpgrade function in the LevelOne contract fails to validate that the educational session has reached its intended conclusion before allowing graduation and contract upgrade. This critical oversight enables the principal to prematurely terminate academic sessions, upgrade the system, and distribute funds before students have received their full educational term.
The contract establishes a time-bound educational session through the startSession function:
However, the graduateAndUpgrade function contains no temporal validation whatsoever:
This function should include a check that verifies block.timestamp >= sessionEnd to ensure the session has properly concluded.
This vulnerability introduces several critical issues to the educational system:
Economic Impact:
Students pay school fees (stored in bursary) with the expectation of a 4-week educational term
Premature graduation denies students the full value of their investment
Teachers receive compensation without delivering the complete educational service
Educational Integrity Violation:
The academic process is compromised when sessions can end arbitrarily
Student evaluation may be incomplete if the graduation occurs before sufficient reviews
The cutOffScore mechanism becomes ineffective if students are graduated before final assessments
System State Corruption:
After graduation, the system remains in an inconsistent state where inSession = true
This state inconsistency could affect future operations or integrations
Trust and Fairness:
The arbitrary nature of session termination undermines trust in the educational platform
Students are subject to unequal treatment if some sessions run full-term while others are cut short
The critical vulnerability is in the graduateAndUpgrade function:
The principal calls startSession(70) to start a session with a cutoff score of 70
This sets sessionEnd = block.timestamp + 4 weeks
Sets inSession = true
Immediately after (in the same block or next block), the principal calls graduateAndUpgrade(newImplementationAddress, "0x")
The function executes successfully:
The contract is upgraded to the new implementation
Teachers receive their share of the school fees (35%)
Principal receives their share (5%)
The session effectively lasted only minutes instead of the intended 4 weeks
Students have been denied the educational services they paid for, with no recourse
Add mandatory session duration enforcement:
Implement proper state management:
Add an event to track graduation:
`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.