Skip to content
Business logic Audit finding Beginner

Users can’t remove liquidity while a pool is disabled

A pool-disabling feature blocks all liquidity changes, including withdrawals, because a single check rejects any call when the pool is disabled. Users cannot remove their funds during an emergency, leaving their money at risk.

Silvermist Follow with zhaojohnson, nslavchev and 3 others

Originally disclosed on Code4rena

Submitted by Silvermist, also found by zhaojohnson, nslavchev, Testerbot, devival, and prapandey031

There is a functionality for disabling a pool in case of unforeseen circumstances or if a problem occurs. While the pool is disabled the users should not be able to do certain actions but removing their liquidity should not be one of them.

When a problem occurs in the pool, users should be able to remove their liquidity, as it may be at risk and they may lose their money. The problem is there is a check that does not allow them to do it.

Proof of Concept

update_position_internal has a comment that states “Requires the pool to be enabled unless removing liquidity.”, meaning that there should be a check for the pool status only when liquidity is added and the users should be allowed to remove their liquidity if the pool is not active.

But update_position_internal calls update_position that is used to add or remove liquidity from a position and the function has this check:

        assert_or!(self.enabled.get(), Error::PoolDisabled);

The check above prevents the function from being called when the pool is disabled, which is understandable in case users want to add liquidity to the pool when there is a problem.

However, users don’t want their money to be at risk and they would want to remove their funds but they can’t because of that check.

Recommended Mitigation Steps

If the passed delta is negative, it means the user is removing liquidity, so check the pool’s status only when the delta is positive.

Assessed type

Access Control

af-afk (Superposition) confirmed

0xsomeone (judge) commented:

The submission and its duplicates have correctly identified that liquidity withdrawals are disallowed when the pool is paused despite what the code’s documentation indicates.

I believe a medium-risk severity rating is appropriate given that important functionality of the protocol is inaccessible in an emergency scenario when it should be accessible.


The original report as published on Code4rena, by Silvermist. 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 a single pool-enabled check in the shared add/remove liquidity function rejects every call when the pool is disabled, instead of only rejecting calls that add liquidity.

Impact

Users cannot withdraw their liquidity while a pool is disabled, so their funds may be lost if the pool has a problem.

What the attacker needed

Pool is disabled; user has liquidity in the pool

The fix

The pool status should be checked only when liquidity is being added, for example by testing whether the delta is positive.

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.

A liquidity pool is a shared pot of cryptocurrency that users add money to and take money out of. The pool can be switched off in an emergency, but the code also stops people from taking their own money back out while it is off. That means their funds stay stuck in a pool that may be unsafe.

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 Silvermist

View all

4 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.