Users unable to remove liquidity from disabled pools #102
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
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 internallyupdate_position_internal
which in turn will call the following functionself.pools.setter(pool).update_position(id, delta)?;
in thepool.rs
contract. Theupdate_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
updatePositionC7F1F740()
with a negativedelta
.Tools Used
Manual review
Recommended Mitigation Steps
Modify the logic to allow liquidity removal even when the pool is disabled.
Assessed type
Other
The text was updated successfully, but these errors were encountered: