Victims can lose a significant amount of stakes if they cancel participation in two scenarios:
Victims call BriVault::deposit multiple times (only stakes for the last call can be refunded).
Attackers call BriVault::deposit with a tiny amount of stakes on behalf of victims after victims deposit (only that tiny amount can be refunded).
This is caused by wrong increment logic for BriVault::stakedAsset. Each time a new deposit call from the same depositor will overwrite last staked asset amount.
Likelihood:
Extremely likely since there is no restriction for players to deposit only one time.
Very cost efficient for griefing: attackers cost only a tiny amount of assets to overwrite victims' staked amount, causing a fund lock.
Impact:
Even though victims can directly call ERC-4626 redeem to withdraw all funds, it is not an intended move, and it will harm other players' interest. (see [H-02] ERC-4626 methods not restricted, hence players can change their stakes and shares at any time, even after winner is set.) There is no way for victims to cancel participation without a loss. The only possibility for victims to get back the money is to win the bet.
Wrong staked amount accounting and broken cancel mechanism will disincentivize participants.
In this attack flow, a malicious attacker locks a victim's stake before event starts. The victim will face fund loss if they cancels participation.
How to run this test: Paste test function test_exploitNoIncrementStaking() in file test/briVault.t.sol.
Fix the stake amount logic, staked asset should be able to add increment.
Vault tracks only a single deposit slot per user and overwrites it on every call instead of accumulating the total.
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.