Possible liquidity deflation attack #119
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-442
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2022-12-caviar/blob/0212f9dc3b6a418803dbfacda0e340e059b8aae2/src/Pair.sol#L63
Vulnerability details
Impact
The AMM implemented in the
Pair
contract is subject to a liquidity deflation attack upon deployment. In this attack:add
function, providing a small amount of base and fractional tokens. The attacker receives the corresponding amount of LP tokens.Pair
contract, a large amount of base and fractional tokens.This gives the first liquidity provider the possibility to make it very costly for all other LPs to enter the pool, and potentially control the vast majority of the liquidity in a pair, leaving out smaller players.
Tools Used
Manual review
Recommended Mitigation Steps
This is a long known issue in this kind of AMMs, and there's already a solution available, pioneered by Uniswap V2.
It's based on implementing a minimum liquidity threshold in the pair. Essentially, during the first liquidity provision, part of the minted LP tokens are burned (instead of being transferred to the provider). I suggest reading the discussion in the Uniswap v2 audit for more details.
The text was updated successfully, but these errors were encountered: