The LevelOne contract lacks a mechanism to end a school session once it's started. The contract tracks a sessionEnd timestamp but never uses it to actually end the session. This results in a school that remains permanently "in session" once the first session begins, preventing any new student enrollments indefinitely.
When the startSession() function is called, it sets inSession = true and calculates a sessionEnd timestamp, but there is no corresponding function or mechanism to set inSession back to false once this end time is reached.
The test below demonstrates this vulnerability by showing that the school remains in session even after the sessionEnd time has passed:
The crucial issue is that Ethereum smart contracts don't have automatic time-based triggers. The contract sets sessionEnd = block.timestamp + 4 weeks, but this is simply a stored value that doesn't automatically update any state when that time is reached. The notYetInSession modifier only checks the boolean flag inSession, not whether the current time exceeds sessionEnd.
Permanent Lock State: After the first session starts, the school is permanently "in session".
Enrollment Restriction: No new students can ever enroll after the first session begins.
Single Session Limitation: The school can never have multiple academic sessions/years.
Operational Failure: This makes the contract unusable for ongoing educational operations, as it can only support a single cohort of students.
Foundry testing framework
Manual code review
Custom test function demonstrating the issue (testNoSessionEndMechanism())
Adding an explicit session end function that can only be called by the principal:
`inSession` not updated after during upgrade
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.