Hawk High

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

Unrestricted Student Enrollment Timing might delay the System from being Upgraded

Summary

Students can enroll at any time during a session, preventing fair review cycles.
if a session should close at X time, Enrollment should also have a deadline, (e.g., 1 week prior).
So all students should have equal time to receive 4 weekly reviews.

Vulnerability Details

students can join at any time during the session, and if maybe two weeks has passed before enrollment, such a student will not be graduated because the session would have closed before he receives 4 weekly reviews and this will delay the session from coming to conclusion, since the system requires that all the students must be reviewed before the Upgrade.

POC

function test_confirm_cannot_graduate_with_pending_reviews() public schoolInSession {
// Fast forward to session end
vm.warp(block.timestamp + 1 weeks);
vm.prank(alice);
levelOneProxy.giveReview();
vm.warp(block.timestamp + 1 weeks);
vm.prank(alice);
levelOneProxy.giveReview();
vm.warp(block.timestamp + 1 weeks);
vm.prank(alice);
levelOneProxy.giveReview();
// Juli joins after 3 weeks
vm.startPrank(Juli);
usdc.approve(address(levelOneProxy), schoolFees);
levelOneProxy.enroll();
vm.stopPrank();
//this additional two weeks would have
vm.warp(block.timestamp + 1 weeks);
vm.prank(alice);
levelOneProxy.giveReview();
levelTwoImplementation = new LevelTwo();
bytes memory data = abi.encodeCall(LevelTwo.graduate, ());
vm.prank(principal);
vm.expectRevert(LevelOne.HH__PendingReviews.selector);
levelOneProxy.graduateAndUpgrade(address(levelTwoImplementation), data);
}

Impact

System can be upgraded prematurely before session completion, breaking protocol rules.

Tools Used

foundry Tests

Recommendations

All students should have equal time to receive 4 weekly reviews.

uint256 public enrollmentDeadline; // Set during initialize()
error HH__EnrollmentClosed();
function enroll() external notYetInSession {
if (block.timestamp > enrollmentDeadline) {
revert HH__EnrollmentClosed();
}
// Rest of existing logic...
}
Updates

Lead Judging Commences

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

Support

FAQs

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