Skip to content
Business logic Audit finding Intermediate

Emergency withdraw might not be enough if the underlying pool is a nested pool

The emergency withdraw function only exits the top-level pool, so if the underlying pool is a nested pool that is in recovery mode or exploited, the position cannot be fully unwound. An attacker could exploit the nested pool while the emergency withdraw fails to protect the funds.

mstpr-brainbot Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-10-notional-judging/issues/52

Found by

mstpr-brainbot

Summary

Emergency withdraw is can be called in various cases. The protocol team states that it can be called when a balancer pool enables "enableRecoveryMode" and maybe it can be called when the pool has an exploit and it needs to be unwinded immediately. However, if the actual pool is a nested pool that has an another pool lp as its underlying and that pool has the exploit or "enableRecoveryMode" toggle on then the emergency withdraw will not be able to exit the position properly since the actual pool that has the emergency issue is the nested pool.

Vulnerability Detail

Assume that there is a CPS-wstETH-rETH, WETH weighted pool where as this weighted pool has only 2 tokens which is the weth token and the cps-wsteth-reth bpt token. If the emergency withdraw is called the vault will receive those two tokens. However, if the actual problem (maybe exploit or recovery mode toggle on) happens in the underlying pool then the emergency withdraw will not be able to cover the emergency situation.

Impact

It is likely to have these type of pools and it might make sense to deposit them. However, the emergency withdraw should be properly seated for these type pools to maintain the emergency functionality. Since the protocol team states that any pool that has a notional finance assets is listed is eligible for single sided strategy, and in such pools the emergency withdraw can be broken I will label this as medium.

Code Snippet

https://github.com/sherlock-audit/2023-10-notional/blob/7aadd254da5f645a7e1b718e7f9128f845e10f02/leveraged-vaults/contracts/vaults/common/SingleSidedLPVaultBase.sol#L480-L496

Tool used

Manual Review

Recommendation

If the pool is nested make the emergency exit also exits the underlying pool if the emergency role wants to. That way the emergency functionality can work properly for nested pools.

Discussion

jeffywu

This is a fair point.

jeffywu

Fix here is to add a check to ensure that nested pools are not included: https://github.com/notional-finance/leveraged-vaults/pull/72

The original report as published on Sherlock, by mstpr-brainbot. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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 emergency withdraw function does not recursively exit nested pools, so it only returns the top-level pool tokens and leaves the underlying nested pool position intact.

Impact

If a nested pool is exploited or put into recovery mode, the emergency withdraw may fail to unwind the position, potentially leaving funds stuck or exposed.

What the attacker needed

Vault uses a nested pool; nested pool is in recovery mode or exploited

The fix

The fix was to add a check to ensure that nested pools are not included.

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 vault lets users deposit into a pool that itself contains another pool's token. The emergency withdraw only takes out the top-level tokens, not the tokens inside the nested pool. If the nested pool is compromised, the emergency withdraw cannot save the 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 by mstpr-brainbot

View all

43 more disclosed reports, best first.

More from Notional Update #4

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.