Normal Behavior: ThesetCountry() function should only be callable during the setup phase before any users have deposited and joined the event. Once users have selected teams via joinEvent(), the team mappings should be immutable to ensure fairness.
Vulnerability: The setCountry() function has no access control preventing the owner from calling it after users have already joined the event. When the owner changes the teams array after users have bet, it creates a mismatch between the team names stored in userToCountry[user] and the actual team names in the teams array at those indices.
Likelihood: HIGH
Reason 1: Any time a malicious or compromised owner wants to manipulate the outcome after seeing which teams users have bet on, they can call setCountry() to change team mappings.
Reason 2: Any time users have joined the event and the owner calls setCountry() for any reason (even accidentally), all existing user bets become invalid.
Impact: HIGH
Impact 1: Users who bet on the "winning" index cannot withdraw their winnings because their stored team name in userToCountry[user] no longer matches the winner string after the owner changes the teams array.
Impact 2: The owner can effectively steal all user funds by changing team mappings after users join, ensuring no user's stored team matches the declared winner, making all deposits unrecoverable.
Impact 3: Complete loss of trust in the protocol - users have no guarantee their bets will remain valid after joining.
You may copy and paste the below POC on the existing test suite:
Output Confirmation:
Add a check in setCountry() to prevent it from being called after users have joined:
This ensures team mappings are immutable once any user has joined the event, preserving the integrity of all user bets.
This is owner action.
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.