The reviewCount
mapping in the LevelOne
contract is never initialized but is used in the giveReview
function, which leads to unexpected behavior.
The reviewCount
mapping is declared as a state variable but is never initialized with a default value before being used in a comparison in the giveReview
function, like this:
In the giveReview
function, there's a check that relies on this uninitialized value:
However, the function never updates reviewCount
after the check.
This vulnerability leads to 2 issues:
First the reviewCount
check is effectively useless since it's never incremented and the second problem is that the function will always pass this condition as the default value for uint256 is 0
This undermines the intended restriction mechanism and allow an unlimited number of reviews for a student, manipulating their scores unfairly.
Personally I would initialize the reviewCount
mapping for each student when they are enrolled
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.