Skip to content
Business logic Audit finding Intermediate

User may not get IL protection if certain functions are called directly in Pools.sol

The Pools contract's removeLiquidity and removeLiquidityDirectly functions can be called directly, bypassing the Router's removeLiquidity function that provides impermanent loss protection. A user calling these functions directly would not receive IL protection, potentially losing funds they would otherwise be compensated for.

Vader Protocol contest

Originally disclosed on Code4rena

Functions removeLiquidity() and removeLiquidityDirectly() when called directly, do not provide the the user with IL protection unlike when calling the corresponding removeLiquidity() function in Router.sol. This should be prevented, at least for removeLiquidity() or highlighted in the specification and user documentation.

Recommend adding access control (e.g. via a modifier onlyRouter) so removeLiquidity() function of Pools contract can be called only from corresponding Router contract’s removeLiquidity() function which provides IL protection. Alternatively, highlight in the specification and user documentation about which contract interfaces provide IL protection to users.

strictly-scarce (vader) acknowledged:

User should use the Router, as designed.

The original report as published on Code4rena. 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 the Pools contract's removeLiquidity functions lack access control to ensure they are only called via the Router, which implements the IL protection logic.

Impact

A user who calls removeLiquidity or removeLiquidityDirectly directly on the Pools contract would not receive impermanent loss protection, potentially losing funds they would have been compensated for.

What the attacker needed

User calls Pools contract directly; user removes liquidity

The fix

The project acknowledged the issue but did not implement a fix, stating that users should use the Router as designed.

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.

In some crypto systems, if the value of your deposited tokens changes while they are in a pool, you can lose money compared to just holding them. This is called impermanent loss. The system here offers protection against that loss, but only if you use the official 'Router' contract to withdraw. If you interact with the underlying 'Pools' contract directly, you skip that protection and may lose funds.

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 from Vader Protocol contest

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.