The contracts ContestManager
and Pot
fail to validate that the players
and rewards
arrays have the same length when creating a new contest. This oversight can lead to various issues including unfair reward distribution, potential out-of-bounds access, and inconsistencies in the contract's state.
The vulnerability is present in two key areas:
ContestManager.sol:
This function does not check if players.length == rewards.length
before creating a new Pot.
Pot.sol:
The constructor assumes that players
and rewards
have the same length without verification.
If the lengths of these arrays don't match, it can lead to:
Unassigned rewards if players.length > rewards.length
Potential out-of-bounds access if rewards.length > players.length
Incorrect calculation of total rewards
The impact of this vulnerability is severe:
Fairness: Some players may not receive rewards or receive incorrect amounts, compromising the fairness of the contest.
Financial Loss: Mismatched array lengths could lead to unintended fund distribution or locked funds in the contract.
Contract Integrity: The contract's state may become inconsistent, affecting operations like claiming rewards or closing the pot.
Security: Out-of-bounds array access could potentially be exploited for malicious purposes.
Manual code review.
AI for report text and formatting.
To address this vulnerability, we recommend the following:
Implement length checks in ContestManager.createContest():
Add similar checks in the Pot constructor:
By implementing these recommendations, the contract will be more robust against potential misuse and errors related to array size mismatches.
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.