Skip to content
Business logic Audit finding Intermediate

ConcentratedLiquidityPosition.sol#collect() Users may get double the amount of yield when they call collect() before burn()

The collect() function in ConcentratedLiquidityPosition.sol calculates yield based on fee growth but does not always collect fees from the pool when the contract has enough balance. This allows a user to collect yield and later burn liquidity, receiving double the yield and diluting other users' rewards.

WatchPug Follow

Originally disclosed on Code4rena

Submitted by WatchPug

When a user calls ConcentratedLiquidityPosition.sol#collect() to collect their yield, it calcuates the yield based on position.pool.rangeFeeGrowth() and position.feeGrowthInside0, position.feeGrowthInside1:

ConcentratedLiquidityPosition.sol#L75 L101

When there are enough tokens in bento.balanceOf, it will not call position.pool.collect() to collect fees from the pool.

This makes the user who collect() their yield when there is enough balance to get double yield when they call burn() to remove liquidity. Because burn() will automatically collect fees on the pool contract.

Impact

The yield belongs to other users will be diluted.

Recommended Mitigation Steps

Consider making ConcentratedLiquidityPosition.sol#burn() call position.pool.collect() before position.pool.burn(). User will need to call ConcentratedLiquidityPosition.sol#collect() to collect unclaimed fees after burn().

Or ConcentratedLiquidityPosition.sol#collect() can be changed into a public method and ConcentratedLiquidityPosition.sol#burn() can call it after position.pool.burn().

sarangparikh22 (Sushi) confirmed

The original report as published on Code4rena, by WatchPug. 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

Likely, the collect() function does not always call position.pool.collect() to collect fees from the pool when bento.balanceOf is sufficient, leading to double counting of fees when burn() later collects them.

Impact

Other users' yield could be diluted because the attacker receives double yield.

What the attacker needed

User has a position with unclaimed fees; Contract has enough tokens in bento.balanceOf

The fix

The burn() function should call position.pool.collect() before position.pool.burn(), or collect() should be made public and called by burn() after position.pool.burn().

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 provide liquidity, you earn fees. The collect function lets you withdraw those fees. The bug is that if the contract already has enough tokens, collect pays you without taking the fees from the pool. Later, when you remove your liquidity, the pool also pays you fees again, so you get paid twice. This steals from other users because the total fees are shared.

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 WatchPug

View all

197 more disclosed reports, best first.

More from Sushi Trident contest phase 2

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.