Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

Missing `schoolFees` input data in `enroll` function in contract `levelOne`

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; // q we havent taken the input of school fees and not checked for it
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);
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.