In the deposit function the amount of tokens to be minted for the user depends on the finalizedVaultAsset ie: nothing but balance of the vault contract.Attacker can directly transfer asset to the vault contract, this will increase the balanceOf the vault, and this balanceOf is actually used to calculate the amount of shares to be minted. This will cause greifing to the later depositors. The depositors will not get the intended amount of shares they should get or even zero shares if the amount directly transferred to the vault is very large.
Likelihood:
When the attacker is the first to make the deposit and mints share for himself, then attacker directly transfers tokens to the vault.
Impact:
The later depositors do not get intended amount of shares minted to them, causing them a loss.
This poc covers this case -
Scenario A (grief): user1 deposits 1 ETH, then directly transfers 19 ETH to the vault, then user2 deposits 20 ETH → victimSharesGrief.
Scenario B (baseline): revert to just after user1's 1 ETH deposit (no prefund), then user2 deposits 20 ETH → victimSharesBaseline.
The test asserts victimSharesBaseline > victimSharesGrief and emits the share difference.
Try to use a state variable that tracks the amount of assets deposited and that too should be inside the deposit function. And this variable should be used while calculating the amount of shares to be minted to the users.
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.