setCountry() can be called after event creation and user participation causes critical mapping inconsistencies and potential result manipulation
Normally, the setCountry() function should only be callable once, before users start joining the event. This ensures that the teams array remains constant and that the mapping between team indices (countryId) and names stays consistent throughout the tournament lifecycle.
However, the current implementation allows the owner to call setCountry() multiple times and at any moment, even after participants have joined and selected their teams.
Since users’ selections are stored as strings (userToCountry[msg.sender] = teams[countryId]), modifying the teams array after players have joined can invalidate or alter existing mappings — causing users’ stored “countries” to no longer match their intended bets or the actual winning country.
Likelihood:
The issue occurs whenever the owner mistakenly or maliciously calls setCountry() after participants have joined or after the event has started.
Because there is no timestamp or state restriction (eventStartDate / countriesSet flag), this can happen in any real deployment
Impact:
If the owner modifies teams after users have joined, the countryId → teamName mapping changes, breaking stored userToCountry references.
When the winner is later set, comparisons are performed using string equality (keccak256(userToCountry) == keccak256(winner)), leading to false negatives or false positives: legitimate winners may lose rewards or losers may withdraw as winners.
This destroys the fairness and integrity of the entire vault system.
Prevent the setCountry() function from being called after the event starts or once it has been called once.
Replace userToCountry (string-based) with userToCountryId (uint256-based) for efficient and reliable matching.
Compare country IDs directly during withdrawal (userToCountryId[msg.sender] == winnerCountryId) instead of comparing strings.
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.