Submitted by 0xpiken, also found by klau5
https://github.com/code-423n4/2024-12-bakerfi/blob/main/contracts/core/MultiStrategy.sol#L173
The MultiStrategy#_deallocateAssets() function will be DoSed if IStrategy#undeploy(0) is called.
When withdrawing user assets from a multi-strategies vault, it will be withdrawn pro-rata from the strategies base on their deployed assets:
https://github.com/code-423n4/2024-12-bakerfi/blob/main/contracts/core/MultiStrategyVault.sol:
https://github.com/code-423n4/2024-12-bakerfi/blob/main/contracts/core/MultiStrategy.sol:
If a strategy has not yet deployed any assets, its totalAssets() call will return zero. Subsequently, the system will attempt to execute IStrategy.undeploy(0). However, this call is likely to revert, potentially leading to a denial-of-service condition for the entire withdrawal function:
StrategySupplyBase.sol reverts ZeroAmount() when amount is 0:
StrategyLeverage.sol reverts NoCollateralMarginToScale() because totalCollateralInDebt is equal to totalDebtBalance(both of them are 0):
Copy below codes to VaultMultiStrategy.ts and run npm run test:
Check if the amount is 0 before undeploying it:
chefkenji (BakerFi) confirmed
MrPotatoMagic (warden) commented:
0xpiken (warden) commented:
MrPotatoMagic (warden) commented:
Dravee (judge) commented:
BakerFi mitigated:
Status: Mitigation confirmed. Full details in reports from 0xlemon and shaflow2.
