Incorrect Minting of Shares to msg.sender Instead of receiver in BriVault::deposit function (ERC4626 Violation + Asset Loss Risk)
Under ERC-4626 specification, when a user calls deposit(assets, receiver), the vault must mint shares directly to the receiver. The caller (msg.sender) provides the tokens, but the receiver is the beneficiary and must receive the vault shares representing ownership of the deposited assets.
In the current implementation, the briVault::deposit function incorrectly mints shares to msg.sender instead of receiver. As a result, whenever a smart contract deposits on behalf of a user such as a proxy contract the shares are credited to the proxy rather than the intended user. This breaks ERC-4626 compliance and causes misallocation of ownership, potentially locking users out of their assets and enabling privilege abuse or fee capture by unintended parties.
Likelihood:
Any deposit performed through a smart contract, relay, or aggregator automatically triggers the misallocation because msg.sender receives the shares instead of the receiver.
Automated vault interactions, multi-call transactions, and account abstraction systems regularly use proxy contracts, making this behavior likely in standard usage scenarios.
Impact:
Deposited assets do not result in ownership of shares for the intended receiver, preventing withdrawals or participation in rewards and governance.
Malicious or misconfigured intermediaries can capture shares, causing loss of funds or stuck assets for end users.
This PoC reproduces the issue by deploying a contract DepositProxy that calls deposit(...) on behalf of a receiver. The test mints ERC20 tokens to the proxy, makes the proxy approve the vault, performs the deposit, and asserts that the proxy not the receiver received the minted shares.
The proxy (msg.sender) incorrectly receives all minted shares
The receiver receives none, despite depositing assets
Confirms real-world exploitability via proxy/layered calls
Update the minting logic so shares are minted to the correct address
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.