VaderPoolV2.mintFungible exposes users to unlimited slippage #248
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
VaderPoolV2
Handle
TomFrench
Vulnerability details
Impact
Frontrunners can extract up to 100% of the value provided by LPs to VaderPoolV2.
Proof of Concept
Users can provide liquidity to
VaderPoolV2
through themintFungible
function.https://github.com/code-423n4/2021-11-vader/blob/429970427b4dc65e37808d7116b9de27e395ce0c/contracts/dex-v2/pool/VaderPoolV2.sol#L271-L335
This allows users to provide tokens in any ratio and the pool will calculate what fraction of the value in the pool this makes up and mint the corresponding amount of liquidity units as an ERC20.
However there's no way for users to specify the minimum number of liquidity units they will accept. As the number of liquidity units minted is calculated from the current reserves, this allows frontrunners to manipulate the pool's reserves in such a way that the LP receives fewer liquidity units than they should. e.g. LP provides a lot of
nativeAsset
but very littleforeignAsset
, the frontrunner can then sell a lot ofnativeAsset
to the pool to devalue it.Once this is done the attacker returns the pool's reserves back to normal and pockets a fraction of the value which the LP meant to provide as liqudity.
Recommended Mitigation Steps
Add a user-specified minimum amount of LP tokens to mint.
The text was updated successfully, but these errors were encountered: