Skip to content
Business logic Audit finding Intermediate

ConvexSpell#closePositionFarm removes liquidity without any slippage protection

The ConvexSpell and CurveSpell contracts remove liquidity from Curve pools without any slippage protection, passing a minimum output of zero. An attacker could sandwich the withdrawal transaction to manipulate the pool price and steal value from the user.

0x52 Follow with Breeje, Ch_301 and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-04-blueberry-judging/issues/124

Found by

0x52, Breeje, Ch_301, n1punp

Summary

ConvexSpell#closePositionFarm removes liquidity without any slippage protection allowing withdraws to be sandwiched and stolen. Curve liquidity has historically been strong but for smaller pairs their liquidity is getting low enough that it can be manipulated via flashloans.

Vulnerability Detail

ConvexSpell.sol#L204-L208

        ICurvePool(pool).remove_liquidity_one_coin(
            amountPosRemove,
            int128(tokenIndex),
            0
        );

Liquidity is removed as a single token which makes it vulnerable to sandwich attacks but no slippage protection is implemented. The same issue applies to CurveSpell.

Impact

User withdrawals can be sandwiched

Code Snippet

ConvexSpell.sol#L147-L230

CurveSpell.sol#L143-L223

Tool used

Manual Review

Recommendation

Allow user to specify min out

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

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

Impact

User withdrawals can be sandwiched, potentially causing them to receive less than expected.

What the attacker needed

User initiates a withdrawal from a Curve pool; Attacker can sandwich the transaction

The fix

The contract should allow the user to specify a minimum output amount for the withdrawal.

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 withdraw money from a liquidity pool, the amount you get back can change if someone else trades just before you. Here, the contract did not set a minimum amount to receive, so an attacker could trade to make the price worse and pocket the difference. This is called a sandwich attack.

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 0x52

View all

211 more disclosed reports, best first.

More from Blueberry Update #3

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.