The giveReview function in the LevelOne contract checks if a student's reviewCount is less than 5, but this counter is never incremented after a review is given. As a result, while the weekly time restriction works correctly, the total review limit of 5 is ineffective, allowing students to receive an unlimited number of reviews over time.
In the LevelOne contract, the giveReview function contains the following check:
The issue here is that while there is a check limiting the total number of reviews to 5, the reviewCount variable is never incremented after a review is given:
When a review is given, only the lastReviewTime mapping is updated:
While the time restriction correctly limits reviews to one per week, the total review count restriction is completely ineffective since the counter never increases. This means a student could potentially receive an unlimited number of reviews (one per week indefinitely), when the intent appears to be a maximum of 5 total reviews.
This vulnerability has several impacts:
The 5-review limit is completely ineffective
Students can receive an unlimited number of reviews over time
Students with more negative reviews could have their scores continuously reduced below what should be possible
There's no reliable way to track how many reviews a student has actually received
The invariant requiring exactly 4 reviews before graduation cannot be enforced
This is assessed as Medium severity because it breaks core functionality of the review system and can lead to unfair treatment of students. Additionally, it undermines the invariant that students must receive exactly 4 reviews before system upgrade.
Manual code review
Update the giveReview function to properly track the number of reviews a student has received:
Additionally, initialize the reviewCount mapping when students enroll:
`reviewCount` for students is not updated after each review session
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.