Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

[L-1] `LevelOne::giveReview` does not check if session has ended, making it able for a student to get a review even tho the 4 weeks have passed

Description: In function LevelOne::giveReview there are is no check if the session period has ended and the 4 weeks have passed. This enables teachers to give reviews to students after the 4 weeks. Students who already had 4 reviews could now have 5, and students who should have not passed because they had only 3 can now have 4 and pass.

Impact: Students are able to get reviews even if the school session period has ended.

Proof of Concept: As we can see in the test, after 4 weeks a student is given a review and it does not revert.

function testStudentCanGetReviewsEvenIfSchoolSessionTimeHasPassed() public schoolInSession {
levelTwoImplementation = new LevelTwo();
levelTwoImplementationAddress = address(levelTwoImplementation);
bytes memory data = abi.encodeCall(LevelTwo.graduate, ());
vm.warp(block.timestamp + 4 weeks);
vm.prank(alice);
levelOneProxy.giveReview(harriet, true); // does not revert
vm.prank(principal);
levelOneProxy.graduateAndUpgrade(levelTwoImplementationAddress, data);
}

Recommended Mitigation: Add a check in the giveReview to see wether the sessionEnd period has passed or not.

function giveReview(address _student, bool review) public onlyTeacher {
if (!isStudent[_student]) {
revert HH__StudentDoesNotExist();
}
+ if (block.timestamp >= sessionEnd) {
+ revert();
+ }
.
.
.
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

session state not updated

`inSession` not updated after during upgrade

Support

FAQs

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

Give us feedback!