Summary
Missing Input data in enroll
function in levelOne.sol
. schoolFess
input is missing , User can enroll in the session without providing the school fees .
Vulnerability Details
Missing schoolFees
Input data in enroll
function in levelOne.sol
. schoolFess
input is missing , User can enroll in the session without paying the school fees .
function enroll() external notYetInSession {
if (isTeacher[msg.sender] || msg.sender == principal) {
revert HH__NotAllowed();
}
if (isStudent[msg.sender]) {
revert HH__StudentExists();
}
usdc.safeTransferFrom(msg.sender, address(this), schoolFees);
listOfStudents.push(msg.sender);
isStudent[msg.sender] = true;
studentScore[msg.sender] = 100;
bursary += schoolFees;
emit Enrolled(msg.sender);
}
https://github.com/CodeHawks-Contests/2025-05-hawk-high/blob/3a7251910c31739505a8699c7a0fc1b7de2c30b5/src/LevelOne.sol#L143
Impact
User can enroll in the session without paying the schoolFees
and it can cause contract to loose fund, becouse more unwanted users can enrol in it .
Tools Used
Manual review
Recommendations
Take the input parameter of schoolFees
function enroll(uint256 _schoolFees) external notYetInSession {
if (isTeacher[msg.sender] || msg.sender == principal) {
revert HH__NotAllowed();
}
if (isStudent[msg.sender]) {
revert HH__StudentExists();
}
usdc.safeTransferFrom(msg.sender, address(this), _schoolFees);
listOfStudents.push(msg.sender);
isStudent[msg.sender] = true;
studentScore[msg.sender] = 100;
bursary += _schoolFees;
emit Enrolled(msg.sender);
}