Due to the way the list of students is looped through when using the 'expel()' function, if there are a large number of students that enroll in the school session the function may not be able (or may not be feasible) to be called due to high gas cost. This could allow an attacker to enroll with many accounts if the enroll fee is too low and can prevent them from being expelled for breaking any rules.
Within the 'expel()' function, the way the list of students is iterated through is not optimal so there is increasing gas cost and complexity as the number of students increases, reaching a point where the gas cost to use the function will be extraordinarily high:
This could allow for an attacker to not be punished for bad behavior/breaking the rules if the list of students is too high, breaking a key invariant.
Manual review and Foundry
Assuming the protocol does not want a large number of students per given session, a simple solution would be to implement a limit in the number of students that could be enrolled per session so that gas costs aren't allowed to get too high for the 'expel()' function to be called:
If having a max on the number of students that can enroll per session is not a feasible solution for the protocol, they would need to change the way in which they iterate through the list by instead using an index.
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.