Submitted by 0xNineDec, also found by 0xBeirao, peanuts, immeas, nadin, Breeje, Qeew, Josiah, RaymondFam, 0xNazgul, rbserver, KIntern_NA, giovannidisiena, MyFDsYours, koxuan, gjaldon, Blockian, savi0ur, 0xRajkumar, CRYP70, chaduke, Ruhum, rvi0x, and UdarTeam
The first depositor can be front run by an attacker and as a result will lose a considerable part of the assets provided.
The vault calculates the amount of shares to be minted upon deposit to every user via the convertToShares() function:
When the pool has no share supply, the amount of shares to be minted is equal to the assets provided. An attacker can abuse this situation and profit off the rounding down operation when calculating the amount of shares if the supply is non-zero. This attack is enabled by the following components: frontrunning, rounding down the amount of shares calculated and regular ERC20 transfers.
The Vault charges zero fees to conduct any action.
This process gives Bob a 500k asset profit and Alice incurs a 500k loss:
Output:
This same issue is commonly found in vaults. Spearbit also reported this on their Maple V2 audit as the primary high risk issue.
Both initial amounts should be set carefully as they partially harm the first depositor. Those amounts should be high enough to reduce the profitability of this attack to the first depositor but not excessively high which could reduce the incentive of being the first depositor.
RedVeil (Popcorn) confirmed 
