Skip to content
Business logic Audit finding Intermediate

No slippage control when withdrawing a position leads to loss of funds

A withdrawal function that let users set minimum amounts to receive was removed, so the only way to withdraw now offers no slippage protection. An attacker could sandwich a user's withdrawal and take a large amount of their funds.

DadeKuma Follow

Originally disclosed on Code4rena

Submitted by DadeKuma

An attacker can sandwich a user withdrawing funds as there is no way to put slippage protection, which will cause a large loss of funds for the victim.

Proof of Concept

decr_position_09293696 function was removed entirely. Now, the only way for users to withdraw funds is by calling update_position_C_7_F_1_F_740 with negative delta.

The issue is that in this way, users can’t have any slippage protection. decr_position allowed users to choose an amount_0_min and amount_1_min of funds to receive, which is now zero.

This allows an attacker to sandwich their withdrawal to steal a large amount of funds.

Recommended mitigation steps

Consider reintroducing a withdrawal function that offers slippage protection to users (they should be able to choose amount_0_min, amount_1_min, amount_0_desired, and amount_1_desired).

af-afk (Superposition) acknowledged

0xsomeone (judge) commented:

The submission has demonstrated that liquidity withdrawals from the system are inherently insecure due to being open to arbitrage opportunities as no slippage is enforced.

I am unsure why the Sponsor has opted to acknowledge this submission as it is a tangible vulnerability and one that merits a high-risk rating. The protocol does not expose a secure way to natively extract funds from it whilst offering this functionality for other types of interactions.

af-afk (Superposition) commented:

@0xsomeone - we won’t fix this for now since Superposition has a centralised sequencer, and there’s no MEV that’s possible for a third-party to extract using the base interaction directly with our provider.

DadeKuma (warden) commented:

@af-afk - I highly suggest fixing this issue, as a centralized sequencer does not prevent MEV extraction. You can check this impact on Arbitrum, for example.


The original report as published on Code4rena, by DadeKuma. 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 withdrawal path was changed to a single update function with a negative delta that has no minimum-output parameters, so users cannot bound the price they accept.

Impact

A user withdrawing funds could lose a large amount to a sandwich attack; the sponsor argued a centralised sequencer prevents third-party MEV, but the warden disputed this and cited MEV on another chain.

What the attacker needed

User withdraws from the pool; attacker can order transactions around it

The fix

A withdrawal function should be reintroduced that lets users set minimum and desired amounts for both tokens.

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 from a trading pool, the price can move while your transaction waits. A sandwich attack is when someone places trades just before and after yours to shift the price in their favour and profit from your loss. Normally you set a minimum amount you will accept, called slippage protection, so the trade fails if the price moves too far; here that option was removed.

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 DadeKuma

View all

19 more disclosed reports, best first.

More from Superposition

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.