Description: The Pot::claimCut
function updates the remainingRewards
by subtracting the reward amount without explicitly checking for underflow. Although Solidity 0.8+ includes built-in overflow and underflow checks, ensuring logic correctness is crucial for clarity and future-proofing the code.
Impact: If there were any logic errors or changes in Solidity's behavior, subtracting a larger reward than remainingRewards
could lead to an underflow, resulting in incorrect state updates and potentially allowing more rewards to be claimed than available.
Proof of Concept:
If remainingRewards is less than reward, the subtraction would underflow in versions prior to Solidity 0.8. However, in Solidity 0.8+, this would revert automatically.
Recommended Mitigation: Although Solidity 0.8+ handles this automatically, it's a good practice to ensure the logic is clear and robust:
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.