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.
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
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
Tool used
Manual Review
Recommendation
Allow user to specify min out
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.