Owner Can Steal Participant Funds by Designating Themselves as the Winner.The protocol contract designates the owner as the sole authority to set the outcome of an event via the briVault::setWinner() function.
However, there is no restriction preventing the owner (or an address controlled by them) from participating in the same event using briVault::joinEvent().
Likelihood:
Reason 1 Whenever the user owner wishes, they have the authority to assign the winner and participate in the event.
Impact:
Impact 1 This design flaw breaks the protocol's trust model and allows the owner to guarantee their victory 100% of the time.
Impact 2 A malicious owner can wait for users to deposit funds into the event, participate themselves, and then simply call briVault::setWinner() with the team they chose, thereby draining all the funds staked by other participants into their own account.
The following proof of concept simulates a real-world exploitation scenario:
Victim (userA) deposits funds and bets on team 1.
Attacker (owner) deposits a smaller amount of funds and bets on team 9.
The Attacker calls setWinner(9), declaring the team they bet on as the winner.
The Attacker withdraws their winnings, which include the victim's funds.
The final asserts confirm that the owner's final balance is greater than their initial deposit (proving fraudulent profit) and that the victim's balance is zero (proving the loss).
To prevent the exact owner address from participating, a check should be added to the briVault::joinEvent() function:
The root problem is the centralization of the briVault::setWinner() function. The protocol will never be truly decentralized or trustless as long as a single entity decides the results.
The recommended solution is to completely remove the briVault::setWinner() function and replace it with a decentralized mechanism, such as an oracle. For example, using a service like Chainlink Data Feeds would allow the contract to fetch event results from reliable on-chain sources.
This is owner action and the owner is assumed to be trusted and to provide correct input arguments.
The owner is trusted.
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.