The `BriVault::deposit(uint256 assets, address receiver)` function records the staked amount for `receiver` but mints ERC20 shares to `msg.sender`. This breaks accounting invariants: the vault believes `receiver` staked, but the depositor receives the shares.
Likelihood:
When third‑party deposits on behalf of other users are accepted by frontends or integrations (common UX that supports "deposit on behalf"), a malicious depositor can intentionally supply a different receiver value to mint shares to themselves while recording the stake under the victim address.
When off‑chain scripts or relayers submit transactions that pass a receiver differing from the payer (for example, gas‑sponsored deposits or meta‑transactions), the mismatch between stored stake and minted shares will occur and remain unnoticed without explicit invariants/tests.
Impact:
Depositor can deposit on behalf of another address but get the shares for themselves.
This allows the depositor to unfairly participate in events, claim rewards, or withdraw funds, effectively misappropriating tokens.
Accounting inconsistencies can cascade to other functions relying on stakedAsset vs balanceOf.
1. User2 approves and deposits 1 ether (mock ERC20 units) on behalf of user1.
2. `stakedAsset` is credited to user1, but ERC20 shares are minted to user2.
3. Inspect `stakedAsset` and balances.
Add the following to `briVault.t.sol`
Mint shares to the `receiver` instead of `msg.sender` to align staked assets and ERC20 balances:
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.