Normally, the function should remove the user and refund everything except fee. The user should not have any trace of share left in the protocol.
If the user has already joined a game, briVault::cancelParticipation does not remove his share in briVault::userSharesToCountry, his position in briVault::userAddressand briVault::userToCountry. It also does not deduct him from the briVault::numberOfParticipants.
Likelihood: High
Reason 1: When a user decide to cancel his participation this happens.
Reason 2: When an exploiter wants to bet across multiple account he can deposit, join and cancel while keeping his position in the game.
Impact: High
Impact 1: An exploiter could create 48 accounts and use one account to deposit, join, cancel for each team. The current vulnerability in thebriVault:withdraw function allows users with the correct briVault::userToCountry to withdraw a portion of the prize pool depending on the amount of vault token they hold.
The attacker deposit, join and cancel using many account to cover all the possible outcomes.
The normal users deposit, join and cancel one by one.
Time passes and the owner pick the winner based on the outcome of tournament.
The attacker transfer remaining vault token to the winner.
the winner withdraw money from the prize pool. In this case, the attacker started with 20 tokens and ended up with 253 tokens.
Modify the storage variables when refunding to the user and refund the balance of the user instead of the value in briVault::stakedAsset. The user is not removed from the briVault::userAddress since we don't know the index of the user and it will cost a lot to loop through the array if the user joined late. This will not affect anything because briVault::userSharesToCountry is set to zero for the user for all countries.
CancelParticipation burns shares but leaves the address inside usersAddress and keeps userSharesToCountry populated.
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.