Description:
The joinEvent() function does not prevent users from calling it multiple times with different countryId values. A malicious user can deposit once and then join all 48 teams, guaranteeing they will be on the winning team and able to withdraw their share of the pool.
The vulnerability exists because:
There is no check to prevent multiple calls to joinEvent()
The userToCountry mapping is overwritten on each call, but userSharesToCountry accumulates shares for each country
The user's address is pushed to usersAddress array multiple times
Impact:
Malicious users can guarantee profits by betting on all teams
Legitimate users who bet on a single team will receive significantly reduced payouts
The entire betting mechanism is compromised as users can hedge all positions
Pool distribution becomes unfair and exploitable
Proof of Concept:
Mitigation:
Add a mapping to track whether a user has already joined an event and add a check in joinEvent():
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.