Skip to content
Business logic Audit finding Intermediate

VaderPoolV2.mintFungible exposes users to unlimited slippage

The mintFungible function in VaderPoolV2 allows users to provide liquidity without specifying a minimum number of LP tokens to receive. A frontrunner can manipulate the pool's reserves to cause the liquidity provider to receive fewer LP tokens than they should, extracting up to 100% of the provided value.

TomFrenchBlockchain Follow

Originally disclosed on Code4rena

Submitted by TomFrenchBlockchain, also found by pauliax and robee

Frontrunners can extract up to 100% of the value provided by LPs to VaderPoolV2 as fungible liquidity.

Proof of Concept

Users can provide liquidity to VaderPoolV2 through the mintFungible function.

https://github.com/code-423n4/2021-12-vader/blob/fd2787013608438beae361ce1bb6d9ffba466c45/contracts/dex-v2/pool/VaderPoolV2.sol#L311-L317

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 little foreignAsset, the frontrunner can then sell a lot of nativeAsset 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 liquidity.

Recommended Mitigation Steps

Add a user-specified minimum amount of LP tokens to mint.

SamSteinGG (Vader) acknowledged

Jack the Pug (judge) decreased severity to medium and commented:

I’m downgrading this [from high] to med and merging all the issues related to slippage control into this one.


The original report as published on Code4rena, by TomFrenchBlockchain. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The mintFungible function lacks a user-specified minimum amount of LP tokens to mint, allowing frontrunners to manipulate reserves and reduce the LP tokens received.

What the attacker needed

LP provides liquidity via mintFungible; attacker can frontrun the transaction

The fix

Add a user-specified minimum amount of LP tokens to mint.

How it was found

  1. LP calls mintFungible to provide liquidity in a skewed ratio (e.g., a lot of nativeAsset but very little foreignAsset).
  2. Frontrunner sells a lot of nativeAsset to the pool to devalue it.
  3. LP's transaction executes, minting fewer liquidity units than they should.
  4. Attacker returns the pool's reserves back to normal and pockets a fraction of the value.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you add money to a liquidity pool, you get pool tokens representing your share. This code lets you add money without saying the minimum pool tokens you'll accept. An attacker can quickly change the pool's balance before your transaction, so you get fewer pool tokens and lose value.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by TomFrenchBlockchain

View all

28 more disclosed reports, best first.

More from Vader Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.