The `withdraw()` function calculates the user’s share using a division by `totalParticipantShares`.
If no participants have joined the event yet (or `totalParticipantShares` is zero), the division will revert with a panic (`division by zero`).
Impact:
Users are unable to withdraw funds when `totalParticipantShares` is zero.
This creates a Denial-of-Service (DoS) vector for the withdraw function.
No direct theft of funds occurs, but it can block legitimate withdrawals and disrupt event logic.
1. User1 deposits tokens and joins the event.
2. Owner sets the winner and totalParticipantShares is zero.
3. User1 attempts to withdraw.
4. Transaction reverts with panic 0x12 (division by zero).
Add the following to `briVault.t.sol`
Add a check to ensure `totalParticipantShares > 0` before dividing, to prevent a division by zero:
When no one bet on the winning team, making totalWinnerShares = 0, causing division by zero in withdraw and preventing any withdrawals.
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.