58452 sc high mytstrategy allocation underflow in deallocate when allocation profits exceed old allocation

Submitted on Nov 2nd 2025 at 13:31:20 UTC by @Brainiac5 for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58452

  • Report Type: Smart Contract

  • Report severity: High

  • Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/MYTStrategy.sol

  • Impacts:

    • Permanent freezing of unclaimed royalties

    • Permanent freezing of unclaimed yield

Description

Summary

The MYTStrategy contract reads stale allocation accounting and thus cannot handle strategies that return profits. When a strategy has earned yield and returns more assets than initially allocated, the subtraction newAllocation = oldAllocation - amountDeallocated underflows, causing transaction reverts and locking funds.

Vulnerable Code

AlchemistAllocator Reads Allocation from Vault

File: src/AlchemistAllocator.sol Lines: 55-67

MYTStrategy Receives Allocation and Underflows

File: src/MYTStrategy.sol Lines: 119-133

Vulnerability Details

The Profit Scenario

  1. Initial State: Strategy allocated 100e6 USDC

  2. Time Passes: Strategy earns 10e6 USDC in yield (10% profit)

  3. Total Assets: Strategy now holds 110e6 USDC worth of shares

  4. Deallocate Call: Vault requests withdrawal of all funds (100e6)

  5. Strategy Returns: _deallocate() withdraws everything and returns 110e6

  6. Calculation: newAllocation = 100e6 - 110e6 = UNDERFLOW

Root Cause Analysis

The allocation tracking assumes:

This works when amountDeallocated <= oldAllocation, but breaks with profits:

  • Old allocation: 100e6

  • Amount deallocated (with profit): 110e6

  • Subtraction: 100e6 - 110e6 attempts to store -10e6 in uint256

  • Result: Arithmetic underflow (Solidity 0.8.28 reverts on underflow)

Why Strategies Return More Than Allocated

Yield-generating strategies naturally accumulate value:

Impact

  • Funds Locked: Cannot deallocate from profitable strategies

  • Protocol DOS: Deallocations revert, preventing vault rebalancing

  • Yield Trap: Profits make positions un-withdrawable

  • Liquidity Crisis: Users cannot exit positions that have earned yield

  • Strategy Stuck: Once profitable, strategy becomes permanently locked

Proof of Concept

Proof of Concept

Create Test File: test/VaultAllocationUnderflow.t.sol Add below code to the test file

Run with:

Code snippet

Was this helpful?