The vulnerability occurs within the createContest
function in the Manager contract and the constructor of the Pot
contract. The createContest
function is responsible for deploying the Pot
contract, passing arrays of players and rewards, along with other parameters, to the Pot
constructor.
The Pot
contract constructor does not validate whether the length of the players
array matches the length of the rewards
array. If the players
array is longer than the rewards
array, this will result in an arrayOutOfBound
error when the constructor tries to access an index in the rewards
array that does not exist. This error will prevent the Pot
contract from being deployed, potentially halting the operation of the system.
Contract Deployment Failure: The mismatch between the arrays can cause the deployment of the Pot
contract to fail, leading to an inability to create new contests.
Foundry
The code below fixes the issue and rightly checks if there's an array mismatch between rewards and players array. If there is a mismatch it reverts and informs the deployer why the deployment didn't go through.
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.