56909 sc low incorrect balance snapshot in strategy deallocation causes false loss events and masks real shortfalls

Submitted on Oct 21st 2025 at 17:15:26 UTC by @ihtishamsudo for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #56909

  • 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 deallocation logic in MorphoYearnOGWETHStrategy measures “before” and “after” balances after the withdrawal operation, causing the strategy to compute zero redeemed assets on every deallocation.

Vulnerability Details

Both wethBalanceBefore and wethBalanceAfter are sampled after vault.withdraw. Therefore, wethRedeemed is computed as 0 every time, regardless of what the vault actually returned.

function _deallocate(uint256 amount) internal override returns (uint256) {
        vault.withdraw(amount, address(this), address(this)); //@audit incorrect order
        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);
        }
        require(wethRedeemed + wethBalanceBefore >= amount, "Strategy balance is less than the amount needed");
        require(TokenUtils.safeBalanceOf(address(weth), address(this)) >= amount, "Strategy balance is less than the amount needed");
        TokenUtils.safeApprove(address(weth), msg.sender, amount);
        return amount;
    }

Impact Details

StrategyDeallocationLoss is emitted on every deallocation with misleading data (looks like total loss: actualAmountSent=0) and actual redeemed funds are never measured correctly.

References

https://github.com/alchemix-finance/v3-poc/blob/b2e2aba046c36ff5e1db6f40f399e93cd2bdaad0/src/strategies/mainnet/MorphoYearnOGWETH.sol#L49

Proof of Concept

Proof of Concept

Add following in MorphoYearnOGWETHStrategy.t.sol and execute test with forge test --mt test_bug_emits_false_loss_event -vvv

  • Test logs

Was this helpful?