58244 sc low incorrect balance check order in morphoyearnogweth strategy leads to false deallocation loss events
Submitted on Oct 31st 2025 at 16:48:00 UTC by @dobrevaleri for Audit Comp | Alchemix V3
Report ID: #58244
Report Type: Smart Contract
Report severity: Low
Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/strategies/mainnet/MorphoYearnOGWETH.sol
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
The MorphoYearnOGWETHStrategy::_deallocate() function incorrectly checks WETH balances before and after the withdrawal operation, causing the StrategyDeallocationLoss event to always be emitted with actualAmountSent as 0, even when no actual loss occurs.
Vulnerability Details
The issue exists in the MorphoYearnOGWETHStrategy::_deallocate() function. The function calls vault.withdraw() before capturing the balance measurements, resulting in incorrect loss calculations:
function _deallocate(uint256 amount) internal override returns (uint256) {
@> vault.withdraw(amount, address(this), address(this));
uint256 wethBalanceBefore = TokenUtils.safeBalanceOf(address(weth), address(this));
uint256 wethBalanceAfter = TokenUtils.safeBalanceOf(address(weth), address(this));
uint256 wethRedeemed = wethBalanceAfter - wethBalanceBefore;
if (wethRedeemed < amount) {
emit StrategyDeallocationLoss("Strategy deallocation loss.", amount, wethRedeemed);
}
// ... rest of function
}The correct implementation should capture wethBalanceBefore prior to the withdrawal operation and wethBalanceAfter following it. Currently, both balance checks occur after the withdrawal, resulting in wethBalanceBefore and wethBalanceAfter being identical values. This makes wethRedeemed = wethBalanceAfter - wethBalanceBefore = 0, which will always be less than the requested amount (assuming amount > 0).
Impact Details
The StrategyDeallocationLoss event is incorrectly emitted on every deallocation operation, regardless of whether an actual loss occurred. .
References
Proof of Concept
Proof of Concept
Was this helpful?