Hawk High

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

A teacher can give a student a review even if the school session has not been started yet

Summary

This vulnerability allows the teacher to give a student a review, even if the school session has not been started yet, which breaks the rules and implementation of the protocl, where the reviews are only given during the study period - and it suppose to be - based on the students behavior and performance.

Vulnerability Details

1- Navigate to test/LeveOnelAndGraduateTest.t.sol file.

2- add the following PoC code to the test file:

function testTeacherCanReviewEvenSchoolSessionHasNotBeenStarted() public {
vm.warp(block.timestamp + 1 weeks);
_teachersAdded();
_studentsEnrolled();
vm.prank(alice);
levelOneProxy.giveReview(clara, false);
console2.log(
"Clara's Final score is: ",
levelOneProxy.studentScore(clara)
);
}

3- in the command line, run the following command: forge test --match-test testTeacherCanReviewEvenSchoolSessionHasNotBeenStarted -vvv

4- The output will be as following --> Clara's Final score is: 90

5- Note that In the test I didn't use :

vm.prank(principal);
levelOneProxy.startSession(70);

Which indicates that the session is not being started.


Impact

the teacher to be able to review the student when the school session is not being started yet is a clear break for the protocol rules and implementations where the reviews are only should be given to students by teachers through only the session time - 4 weeks -, otherwise the teacher shouldn't be able to review the students.

If the teacher reviews the students when no session is being held, what will the review be based on?

Tools Used

  • Manual Recon

  • foundry test suite


Recommendations

Add :

+ if (inSession == false) {
+ revert();
+ }

in the beginning of LevelOne:giveReview function.

Updates

Lead Judging Commences

yeahchibyke Lead Judge
28 days ago
yeahchibyke Lead Judge 17 days 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.