msg.sender in the deposit function instead of receiver ,making it impossible to sponsor assets for someone, hence losing deposited assets everytime someone sponsor for another person (i.e. address).In the deposit::BriVault function, there are two parameters: uint256 assets and address receiver .
the assets are being transfered by msg.sender , but in the bet receiver's address is stored .
Which means that either a person deposit by themself and hence passing the receiver's address same as msg.sender .In this case, function will work fine.
But in another scenario, where the msg.sender is sponsoring the assets for receiver , which means it is intended that receiver will be registered for the bet and the shares will be minted to receiver .
In the current scenario, this is not possible as instead of minting the shares to receiver ,it is being minted to msg.sender ,and msg.sender can't join the event too, as the registered person is receiver who doesn't have any shares, hence have no chance to win the bet.
Likelihood: High/Medium
It is likely possible that assets are being sponsored.
It is highly assumed by looking at the function that the address receiver parameter is for sponsership reason.
Impact: High
Funds are completey lost and both msg.sender and receiver have abosultely no change of winning if both are different.
msg.sender can't join the event .
receiver has no way to win, as shares are zero even if he is registered.
alice is sposoring assets for bob.
alice and bob -> shares before = 0.
alice calls the deposit(5e18,bob).
alice shares after the function call : 4.925e18 (excluding the fee).
bob shares after the function call : 0e18.
alice calls joinEvent(countryId) in hope that he could join if he got shares.
function revets with error--> noDeposit().
bob can join but has no shares, hence can't win.
It is highly recommended to mint the tokens to receiver address instead of msg.sender .
This simple change will fix the vulnerbility.
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.