The removeTeacher() function lacks a session state validation check, while the similar administrative function expel() properly verifies that the school is in session. This inconsistency creates a logical flaw in the contract's permission model and violates the implied design pattern.
This inconsistency allows the principal to remove teachers at any time, including during active school sessions when teachers are required for student reviews. Removing teachers mid-session could disrupt the academic process, preventing students from receiving their required reviews and potentially blocking system upgrades.
The likelihood of exploitation is medium since it requires the principal to deliberately or accidentally remove teachers during an active session. However, given that the function lacks protection, any principal could make this mistake without warning.
Let's compare the implementations of both functions:
The expel() function begins with an explicit check if (inSession == false) { revert(); } to ensure that a school session is active before expelling a student. This check logically makes sense, as student management should only occur during active sessions.
However, removeTeacher() has no such check, creating an inconsistent pattern in the contract's administrative controls. This allows teachers to be removed at any time, which could disrupt an ongoing session if teachers are removed while students still need reviews.
Given the invariant that "Students must have gotten all reviews before system upgrade," removing teachers mid-session could make it impossible for all students to receive their required reviews, potentially blocking graduation and system upgrades.
Add a session state check to the removeTeacher() function to align with the contract's design pattern:
This ensures that teachers can only be removed outside of active school sessions, maintaining the contract's logical consistency and preventing potential disruption to the academic process.
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.