Hawk High

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

Missing Check for `schoolFees` in `enroll` function

Summary

Missing check for required schoolFees in `enroll function . User can deposit very small amount and let itself enrolled in session .

Vulnerability Details

Missing check for required schoolFees in `enroll function . User can deposit very small amount and let itself enrolled in session .

https://github.com/CodeHawks-Contests/2025-05-hawk-high/blob/3a7251910c31739505a8699c7a0fc1b7de2c30b5/src/LevelOne.sol#L143

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);
}

Impact

User can enroll in the sessrion by paying a very little fees .

Tools Used

manual review

Recommendations

Add the check for schoolFees

function enroll(uint256 _schoolFees) external notYetInSession {
if (isTeacher[msg.sender] || msg.sender == principal) {
revert HH__NotAllowed();
}
if (isStudent[msg.sender]) {
revert HH__StudentExists();
}
if (_schoolFees != schoolFees) {
revert HH__HawkHighFeesNotPaid();
}
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.