Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users unable to remove liquidity from disabled pools #102

Closed
howlbot-integration bot opened this issue Sep 16, 2024 · 1 comment
Closed

Users unable to remove liquidity from disabled pools #102

howlbot-integration bot opened this issue Sep 16, 2024 · 1 comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-31 🤖_59_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality

Comments

@howlbot-integration
Copy link

Lines of code

https://github.com/code-423n4/2024-08-superposition/blob/4528c9d2dbe1550d2660dac903a8246076044905/pkg/seawater/src/pool.rs#L92

Vulnerability details

The AMM contract contains a function updatePositionC7F1F740 which allows users to add or remove liquidity from a position. However, there is a flaw in the logic that prevents users from removing their liquidity if the pool has been disabled. This function will call internally update_position_internal which in turn will call the following function self.pools.setter(pool).update_position(id, delta)?; in the pool.rs contract. The update_position function checks if the pool is enabled before allowing any updates. The issue arises because this check is applied uniformly, regardless of whether the user is adding liquidity (delta > 0) or removing liquidity (delta < 0).

Impact

Users are unable to withdraw their funds from disabled pools, effectively locking their assets indefinitely.

Proof of Concept

  1. Alice adds liquidity to a pool.
  2. The pool is later disabled by the admin for some reason.
  3. Alice tries to remove her liquidity by calling updatePositionC7F1F740() with a negative delta.
  4. The transaction reverts because the pool is disabled, preventing Alice from accessing her funds.

Tools Used

Manual review

Recommended Mitigation Steps

Modify the logic to allow liquidity removal even when the pool is disabled.

Assessed type

Other

@howlbot-integration howlbot-integration bot added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value 🤖_59_group AI based duplicate group recommendation bug Something isn't working duplicate-31 sufficient quality report This report is of sufficient quality labels Sep 16, 2024
howlbot-integration bot added a commit that referenced this issue Sep 16, 2024
@c4-judge
Copy link
Contributor

alex-ppg marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-31 🤖_59_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards sufficient quality report This report is of sufficient quality
Projects
None yet
Development

No branches or pull requests

1 participant