The BriVault contract is designed as a specialized prediction vault. The intended behavior is that funds are locked until the event concludes, at which point only the winners can claim a share of the total prize pool.
The contract inherits from OpenZeppelin's standard ERC4626, but it only overrides the deposit function. It critically fails to override the standard asset withdrawal functions: withdraw(uint256 assets, ...) and redeem(uint256 shares, ...). These functions from the parent contract remain public and retain their original logic, which is to allow any shareholder to redeem their shares for underlying assets at any time. This provides a backdoor that completely bypasses the custom withdraw() logic that checks for winners, allowing any user to exit their position and retrieve their stake.
Likelihood:
This vulnerability is triggered by calling standard, well-documented functions of the ERC4626 interface.
No special conditions are required; any user who has deposited and received shares can immediately exploit this.
Impact:
Total Bypass of Game Logic:The contract's core premise is broken. There is no lock-up period, and the risk of losing one's stake is eliminated.
Prize Pool Draining:** A user who realizes they have lost the bet can call `redeem()` before the winner claims their prize. This removes their stake from the prize pool, directly reducing the amount available for the legitimate winner.
It allows a loser to unfairly retrieve their stake.
This act of draining funds can cause a Denial of Service for the legitimate winner, making their withdraw() transaction revert and preventing them from claiming even the remaining portion of the prize pool.
To enforce the contract's intended logic, you must explicitly disable the standard ERC4626 withdrawal and redeem functions. The best practice is to override them and have them revert with a clear error message. It is also wise to rename your custom withdraw function to avoid confusion.
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.