The enroll
function allows any external address to register themselves as a student, bypassing the intended control of the principal
role. This violates the responsibilities outlined in the project documentation, where the principal
is described as responsible for managing the enrollment process. The lack of access control could lead to unauthorized users enrolling as students and exploiting the system.
The enroll
function:
The function lacks the onlyPrincipal
modifier, which should restrict the enrollment process to the principal
. As a result:
Anyone can call this function and enroll themselves as a student.
This is inconsistent with the project's documentation, which specifies that the principal
is in charge of student management.
Deploy the contract.
Call initialize
to set up the principal
and other parameters.
Any address can call enroll
and successfully register themselves as a student without the principal's involvement.
Unauthorized Access: Any external address can enroll as a student, potentially inflating the listOfStudents
and consuming resources meant for legitimate users.
Loss of Control: The principal
loses their ability to regulate the enrollment process, contradicting their documented role.
Financial Risks: Malicious actors can exploit this to pay the minimum schoolFees
repeatedly, manipulating the system or consuming bursary resources.
Manual Code Review
Enforce onlyPrincipal
Modifier: Modify the enroll
function to restrict its execution to the principal
.
Example:
Update Documentation: Clearly define whether the enroll
function should be publicly accessible or restricted to the principal
.
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.