The usersAddress array can grow unbounded with unlimited and even duplicate entries, causing gas exhaustion and locking all funds.
The usersAddress array should contain unique addresses of participants and limited participants
The joinEvent() function pushes users without any upper limit check and even without checking for duplicates.
Users can call it multiple times or rejoin after canceling, filling the array with duplicates.
Likelihood:
Users can join multiple times with different countries
Cancel and rejoin creates duplicates
Single attacker can execute this easily
Impact:
setWinner() runs out of gas iterating large array
Winner cannot be set
All funds permanently locked
Complete protocol DOS
Here is the PoC for calling joinEvent() multiple times to increase the size of the arrray
To fix the duplication add hasJoined mapping and add an upper bound to the user array to limit the participants
The _getWinnerShares() function is intended to iterate through all users and sum their shares for the winning country, returning the total.
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.