Skip to content
Business logic Audit finding Intermediate

collectLiquidity() Lack of can specify recipient leads to inability to retrieve token1 after entering the blacklist of token0

The collectLiquidity function only allows the caller to receive the collected tokens, with no option to specify a different recipient. If the caller is blacklisted by one of the tokens (e.g., USDC), they cannot collect either token, including the other token (e.g., WETH).

bin2chen Follow

Originally disclosed on Code4rena

Submitted by bin2chen

LP has only one way to retrieve token, first decreaseLiquidity(), then retrieve through the collectLiquidity() method.

collectLiquidity() only has one parameter, tokenId.

    function collectLiquidity(
        uint256 tokenId
    ) external override nonReentrant returns (uint256 amount0Collected, uint256 amount1Collected) {
        (amount0Collected, amount1Collected) = lps.collectLiquidity(tokenId);
    }

So LP can only transfer the retrieved token to himself: msg.sender.

This leads to a problem. If LP enters the blacklist of a certain token, such as the USDC blacklist,

Because the recipient cannot be specified (lps[] cannot be transferred), this will cause another token not to be retrieved, such as WETH.

Refer to NonfungiblePositionManager.collect() and UniswapV3Pool.collect(), both can specify recipient to avoid this problem.

Impact

collectLiquidity() cannot specify the recipient, causing LP to enter the blacklist of a certain token, and both tokens cannot be retrieved.

Recommended Mitigation

    function collectLiquidity(
        uint256 tokenId,
+      address recipient
    ) external override nonReentrant returns (uint256 amount0Collected, uint256 amount1Collected) {
...

wukong-particle (Particle) commented:

Good suggestion, recipient should be added here too: https://github.com/code-423n4/2023-12-particle/blob/main/contracts/libraries/LiquidityPosition.sol#L329

0xleastwood (Judge) commented:

I would argue this is good design and should not be changed to allow for arbitrary recipients. If a token is blacklisted, and a protocol allows the user to circumvent this blacklist, then they may potentially be liable for the behaviour of this individual. Better to take an agnostic approach and leave it as is unless liquidations are ultimately being limited because of this.

wukong-particle (Particle) acknowledged and commented:

I agree with the judge. We shouldn’t facilitate to temper the blacklist. So only acknowledging the issue.


The original report as published on Code4rena, by bin2chen. 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 collectLiquidity function lacks a recipient parameter, forcing tokens to be sent only to the caller.

Impact

If a liquidity provider is blacklisted by one token, they cannot retrieve either token from the position.

What the attacker needed

LP is blacklisted by one token

The fix

The function should be modified to accept a recipient address parameter, as suggested in the report.

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 to a trading pool, you get tokens back when you withdraw. This function only lets you send those tokens to yourself. If a token like USDC blacklists your address, you cannot receive that token, and because you cannot choose a different recipient, you also cannot receive the other token (like WETH).

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 bin2chen

View all

139 more disclosed reports, best first.

More from Particle Leverage AMM Protocol Invitational

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.