LiquidityProviders : Setting new liquidity pool will break contract
The contract owner can change the liquidity pool address at any time, but user funds are held in the old pool. If the owner switches to a new pool, users cannot withdraw their liquidity because the old pool still holds their tokens.
Submitted by cmichel, also found by gzeon
Owners can change the liquidityPool variable any time with the setLiquidityPool function.
If a liquidity pool was already set and users added liquidity with addTokenLiquidity, the tokens are directly transferred to the liquidity pool and not kept in the LiquidityProviders contract.
Changing the liquidityPool to a different contract will make it impossible for the users to withdraw their liquidity using removeLiquidity because the tokens are still in the old liquidityPool and cannot be retrieved.
All users will lose their funds.
Recommended Mitigation Steps
Changing the liquidityPool requires a sophisticated migration mechanism.
Only allow setting the liquidityPool contract once.
ankurdubey521 (Biconomy) acknowledged
pauliax (judge) decreased severity to Medium and commented:
A valid concern, but I am downgrading this to Medium risk because the funds are not lost forever, the same old liquidityPool can be set again by the owner in such a case.
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 owner can change the liquidity pool address without migrating the funds already held in the old pool.
Impact
Users could lose access to their funds, though the owner can restore the old pool to recover them.
What the attacker needed
Owner changes liquidity pool; users have deposited liquidity
The fix
The liquidity pool should be set only once, or a migration mechanism should be added.
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 smart contract lets people deposit tokens into a pool. The owner can point the contract to a different pool, but the tokens stay in the old one. Then users cannot get their tokens back because the contract no longer knows where they are.
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.