joinEvent function fails to prevent users from being repeatedly added to usersAddress, which can dilute the winners' withdrawal amounts.When users call the joinEvent function to participate in the event, the protocol uses the usersAddress array to record participating users.
However, this function allows a single user to be repeatedly added to the usersAddress array, distorting the data in the usersAddress array.
Once usersAddress is used, the totalWinnerShares data becomes completely incorrect.
Likelihood:
If a malicious actor correctly guesses the winnerCountryId, they can easily exploit this vulnerability.
Impact:
When any winner performs a withdraw, the funds they receive may be significantly less than they are entitled to.
Add the following function to test/BriVaultTest.t.sol and run forge test --mt test__joinEvent_withHugeUsers -vv
Console output:
The above example shows a scenario where "only one user participates". They end up withdrawing 985000000000000 (i.e., 0.000985 ether).
If the maximum loop count in the test is changed to 1, they end up withdrawing 985000000000000000 (i.e., 0.985 ether).
The difference is significant.
In the joinEvent function, restrict the same user from "repeatedly executing the addition logic".
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.