briVault::stakedAsset to determine the amount to refund only refunds the amount that the user has deposited in the last deposit.The briVault::cancelParticipation should refund the total amount that the user has deposited. However, it uses briVault::stakedAsset which only records the amount of the last deposit and not the full deposited amount.
Likelihood: High
Reason 1: When a user who deposited multiple times decides to exit the event using briVault::cancelParticipation, this happens.
Impact: High/Medium
Impact 1: When a user who deposited multiple times wants to withdraw, he will only get the refund for his last deposit. He will have to call manually the ERC4626:withdraw to withdraw his money. Which might not be possible later on since being able to callERC4626:withdraw directly is a known vulnerability that is going to be fixed.
Here is a test that can be run in the provided briVault.t.sol . It shows that when the user deposits twice, first time 5 tokens and second time 7 tokens, calling briVault::cancelParticipation only refunds the amount of the second deposit - fee of second deposit.
It is recommended to use the balance of the user which tracks the total shares deposited instead of briVault::stakedAsset which only tracks the last deposit. The following solution does not take into account other vulnerabilities in the function.
Vault tracks only a single deposit slot per user and overwrites it on every call instead of accumulating the total.
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.