This attack vector is introduced because there is no reset for BriVault::userSharesToCountry. If an attacker deposits a huge amount and then call BriVault::cancelParticipation to exit, totalWinnerShares can be miscalculated with an additional large value since BriVault::userSharesToCountry is never cleared. Hence winners' prize will be diluted.
BriVault::joinEvent is not restricted to once per player. Attacker can use one piece of huge deposit to join every possible country. Then totalWinnerShares miscalculation is guaranteed no matter which country is set as the winner.
Likelihood:
Highly likely to happen. Any players with a large asset balance can conduct such griefing attack. Attacker can use one piece of deposit to dilute all 48 countries and then cancel participation to save cost. Total cost of the attack is one-time deposit fee and gas.
Requires no specific roles or permissions to conduct attack process for players.
Impact:
Honest winners will be diluted no matter which country is set as winner country.
Protocol greatly undermined with broken state variable clearing logic and event joining logic.
This fuzz test can introduce a random input from 0 to 47. The attacker will always dilute winners no matter which country is picked as winner country. In this case, victim who joins winning country is supposed to get their principal back (no loser). However, they can only withdraw a very little amount payout.
How to run this test: Paste test function test_exploitGriefingDiluteGuaranteed in file test/briVault.t.sol.
We can use two addtional mappings hasJoined and joinedCountryId to mitigate duplicate join event calls and reset BriVault::userSharesToCountry.
CancelParticipation burns shares but leaves the address inside usersAddress and keeps userSharesToCountry populated.
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.