Hawk High

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

giveReview() does not increment reviewCount

Summary

In the giveReview() function, the contract fails to properly track the number of reviews given to each student. The reviewCount mapping is not incremented, which means that teachers can give an unlimited number of reviews to a student, bypassing the limit set in the require statement. This leads to a potential abuse of the review system and could cause the system to behave unpredictably.


Vulnerability Details

The giveReview() function includes a check that prevents teachers from reviewing a student more than 5 times:

require(reviewCount[_student] < 5, "Student review count exceeded!!!");

However, the contract does not increment the reviewCount mapping after a review is given. This means that a teacher can give an unlimited number of reviews to a student, circumventing the review limit and potentially spamming the student with excessive reviews. The issue stems from the following part of the function, which does not update the review count:

reviewCount[_student]++;

Impact

  1. Infinite Reviews: Since the reviewCount is not incremented, a teacher can give an unlimited number of reviews to a student. This could result in the student being unfairly graded or evaluated.

  2. System Abuse: Malicious actors could exploit this flaw to flood a student’s record with reviews, potentially overwhelming the system or skewing the student’s score.

  3. Unfair Grading: Students could be unfairly penalized or receive disproportionate reviews, leading to unfair assessments in the contract.


Tools Used

  • Solidity 0.8.26 (Compiler)

  • Slither for static code analysis


Recommendations

  1. Increment reviewCount Properly: After each review, the reviewCount for the student should be incremented to ensure that the limit of 5 reviews per student is enforced. Add the following line in the giveReview() function:

    reviewCount[_student]++;
  2. Optional: Consider adding a separate mechanism to track review timestamps or specific review details if more fine-grained control over reviews is needed.


Updates

Lead Judging Commences

yeahchibyke Lead Judge 18 days ago
Submission Judgement Published
Validated
Assigned finding tags:

reviewCount not updated

`reviewCount` for students is not updated after each review session

yeahchibyke Lead Judge 18 days ago
Submission Judgement Published
Validated
Assigned finding tags:

reviewCount not updated

`reviewCount` for students is not updated after each review session

Support

FAQs

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