The giveReview
function deducts 10
points from a student's score for every negative review without validating whether the subtraction would cause the score to drop below zero. This can cause the studentScore
to underflow, wrapping around to a very large uint256
value, which may break logic dependent on valid score ranges or graduation conditions.
A student has a score of 5
.
A teacher submits a bad review.
studentScore
becomes 2^256 - 5
(due to underflow in uint256
).
This gives the student an extremely high score, potentially letting them bypass a cutoff or logic that checks for "top performers."
Integrity Violation: Underflowing studentScore
breaks the intended scoring logic.
False Graduation: A student with a huge wrapped score could wrongly qualify for benefits (e.g., graduation).
Review System Compromise: Undermines the credibility of the review system.
Manual Code Review
Solidity language semantics (uint256
arithmetic behavior pre-0.8 vs post-0.8)
Domain knowledge of smart contract score/trust systems
Fixed Code
This ensures:
Scores never drop below zero.
Good reviews actually benefit students.
Prevents exploit scenarios tied to arithmetic overflows/underflows.
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.