msg.sender instead of receiver causes broken ERC4626 compliance and incorrect accountingAfter calling BriVault::deposit() function, the vaults mints specified amount of shares to receiver.
But, it happens that the BriVault::deposit() function, the vault mints shares to msg.sender instead of the intended receiver.
This breaks the expected ERC4626 behavior where the shares must be minted to the specified receiver.
Likelihood:
This issue occurs whenever a user calls deposit() with a receiver different from msg.sender.
Impact:
The receiver will not receive any vault shares.
The depositor will receive shares that belong to someone else.
Withdrawals and share accounting will break, leading to fund misallocation and potentially locked or inaccessible funds.
ERC4626 compliance is broken, which may cause integration failures with DeFi tools that rely on standard behavior.
Add the following to briVault.t.sol and run forge test --mt testSharesNotMintToReceiver
Expected behavior: user2 should receive shares equal to _convertToShares(assets - fee).
Actual behavior: Shares are minted to user1 instead.
Result:
Replace the minting recipient in deposit() from msg.sender to receiver:
This aligns the implementation with ERC4626 specifications and ensures that deposits made on behalf of another user credit 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.