Controller.inCaseStrategyGetStuck does not update balance
The `Controller.inCaseStrategyGetStuck` function withdraws from a strategy but fails to update the stored balance for that strategy. This causes the controller to believe the strategy holds more funds than it actually does, leading to over-withdrawal attempts in `Controller.withdraw`.
Submitted by cmichel
The Controller.inCaseStrategyGetStuck withdraws from a strategy but does not call updateBalance(_vault, _strategy) afterwards.
Impact
The _vaultDetails[_vault].balances[_strategy] variable does not correctly track the actual strategy balance anymore. I’m not sure what exactly this field is used for besides getting the withdraw amounts per strategy in getBestStrategyWithdraw. As the strategy contains a lower amount than stored in the field, Controller.withdraw will attempt to withdraw too much.
Recommended Mitigation Steps
Call updateBalance(_vault, _strategy) in inCaseStrategyGetStuck.
GalloDaSballo (judge) commented:
Agree with finding, I also believe
inCaseStrategyGetStuckandinCaseTokenGetStuckare vectors for admin rugging, may want to add checks to ensure only non strategy token can be withdrawn from the vaults and strats
BobbyYaxis (yAxis) noted:
It’s a needed function for the strategist. The risk of these functions are mitigated as the strategies and controller should never have a balance of any tokens regardless. So there should be nothing/meaningful for the strategist to ever “rug” in that sense. But we can make this a governance-only feature, rather than strategist.
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 function `inCaseStrategyGetStuck` omits a call to `updateBalance` after withdrawing from a strategy, leaving the stored balance stale.
Impact
The stored balance becomes higher than the actual strategy balance, so `Controller.withdraw` may attempt to withdraw more than available, potentially causing failed withdrawals or incorrect accounting.
What the attacker needed
Strategist role or governance access
The fix
Call `updateBalance(_vault, _strategy)` inside `inCaseStrategyGetStuck` after the withdrawal.
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 keeps track of how much money is in each strategy (an investment plan). When an emergency function takes money out, it forgets to update that record. Later, the contract thinks there is more money than there really is, so it tries to take out too much and fails.
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.