briVault.sol::deposit() incorrectly credits vault shares to msg.sender regardless of the intended recipientNormal behavior - The deposit functionality should mint shares to the receiver that can be msg.sender or a different address.
Issue - If one user wants to deposit for a different user, then the logical error comes in place minting shares to the wrong address. However, stakedAsset[receiver] is being updated and this allows that user to join an event. But his shares are 0. When the winner country is set and if the case is that the user has won, he will actually receive nothing since the withdraw will either revert or transfer 0 amount to the user.
Likelihood:
This is going to occur everytime a user wants to deposit assets for someone else
Impact:
If the receiver is the winner, he will receive nothing.
User deposits asset into the vault for user2 as receiver
User2 is now eligible to join the event as the deposited assets are correctly credited to their account, however the shares are NOT.
Time passes and the event has ended , owner sets the winner country.
User2 is the winner but receives 0 assets back or transaction reverts, we have 2 cases:
case1: if user2 is the only winner , withdraw tx will revert due to division with 0.
case2: If there are multiple winners , assetToWithdraw is 0 due to the fact that User2 shares are 0 and the math for calculating the assets being transfered will always be 0 , since shares(0) multiplied with a number will always be 0. Consider the POC below.
Mint shares to the receiver instead to msg.sender. This ensures the correct logic of the deposit function
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.