msg.sender Instead of receiver in BriVault::deposit Causes Permanent Loss of FundsThe deposit() function in BriVault is designed to accept deposits from msg.sender and allocate the corresponding staked assets and shares to a specified receiver address. This follows the ERC4626 standard where shares should be minted to the receiver parameter, allowing flexible deposit mechanisms such as depositing on behalf of another user.
However, the function mints shares to msg.sender instead of the receiver, while recording the staked assets under the receiver address. This creates a critical mismatch where the receiver has staked assets but zero shares, and msg.sender has shares but no staked assets. Neither party can effectively participate in the event or withdraw funds, resulting in permanent loss of deposited assets.
Likelihood:
Any user depositing on behalf of another address triggers this vulnerability immediately upon calling deposit(amount, receiverAddress) where receiverAddress != msg.sender
Protocols integrating BriVault that implement deposit aggregators, vaults, or proxy contracts depositing on behalf of end users will experience this issue on every transaction
Impact:
Permanent loss of deposited funds, the receiver cannot withdraw winnings even when their selected team wins because they have 0 shares recorded in userSharesToCountry[receiver][countryId]
The msg.sender who receives the shares cannot join the event because BriVault::joinEvent requires stakedAsset[msg.sender] > 0 , causing revert with noDeposit() error
Place this test in test/briVault.t.sol and run
Set the `receiver` to receive the participant shares instead of `msg.sender` :
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.