First depositor of the pool can break minting of the Bath Token shares
Proof of Concept
An attacker -who is the first one to deposit- sends 1 wei and bypasses (totalSupply == 0) condition.
Later a very large amount of donation to the pool and inflates the shares proportionality ratio.
Subsequent depositors instead have to deposit an equivalent sum to avoid minting 0 shares. Otherwise, their deposits accrue to the attacker who holds the only share.
Lines of code
https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/contracts/rubiconPools/BathToken.sol#L557-L585
Vulnerability details
Impact
First depositor of the pool can break minting of the Bath Token shares
Proof of Concept
(totalSupply == 0)
condition.https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/contracts/rubiconPools/BathToken.sol#L557-L585
Tools Used
Manual Review
Recommended Mitigation Steps
Ensure the number of shares to be minted is non-zero Uniswap V2 solved this problem by sending the first 1000 LP tokens to the zero address. The same can be done in this case i.e. when totalSupply() == 0, send the first min liquidity LP tokens to the zero address to enable share dilution.