M-28 highlighted how the slippage protection for the initial deposit which was based only on the minimum shares being issued, was ineffective. A front-run attack made it possible for the attacker to profit. This was because incorrect token ratios could be issued even while keeping the minShares same.
Mitigation
The changes in commit have now added minAddedAmountA and minAddedAmountB params while adding liquidity. M-28 only applied to the first deposit and this fix now mitigates the issue since we can now specify the minimum amount of each token, making the mechanics of the shown front-run attack redundant.
Lines of code
Vulnerability details
Summary
M-28 highlighted how the slippage protection for the initial deposit which was based only on the minimum shares being issued, was ineffective. A front-run attack made it possible for the attacker to profit. This was because incorrect token ratios could be issued even while keeping the
minShares
same.Mitigation
The changes in commit have now added
minAddedAmountA
andminAddedAmountB
params while adding liquidity. M-28 only applied to the first deposit and this fix now mitigates the issue since we can now specify the minimum amount of each token, making the mechanics of the shown front-run attack redundant.Conclusion
LGTM