Skip to content
Business logic Audit finding Advanced

KillSwitch early-return in strategy causes vault-to-adapter asset leakage, mis-accounting, and deallocation DOS

When a strategy's killSwitch is enabled, its allocate() and deallocate() functions return early without moving or approving tokens, even though the vault has already sent assets to the adapter. This strands funds on the adapter, hides them from realAssets(), and makes later deallocations revert, causing mis-accounting and a denial of service on exits.

IronsideSec Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

58035 sc high killswitch early return in strategy causes vault to adapter asset leakage mis accounting and deallocation dos

Submitted on Oct 30th 2025 at 06:43:50 UTC by @IronsideSec for Audit Comp | Alchemix V3

Description

Brief/Intro

When killSwitch is enabled on strategies inheriting MYTStrategy, allocate() returns early without refunding tokens. Because the vault transfers assets to the adapter before invoking allocate(), assets are stranded on the adapter, realAssets() excludes them, allocations remain unchanged, and subsequent deallocations revert (no approvals). This creates an immediate asset mismatch, eventual realized loss on next accrual, and a denial-of-service on exiting via deallocate.

Vulnerability Details

  • The vault sends assets to the adapter before calling allocate():
Solidity
572:589:lib/vault-v2/src/VaultV2.sol
        SafeERC20Lib.safeTransfer(asset, adapter, assets);
        (bytes32[] memory ids, int256 change) = IAdapter(adapter).allocate(data, assets, msg.sig, msg.sender);
        // ... caps checks using 'change' ...
  • Strategy allocate() returns early under killSwitch, but does not refund:
Solidity
113:121:src/MYTStrategy.sol
        if (killSwitch) {
            return (ids(), int256(0));
        }
        require(assets > 0, "Zero amount");
        uint256 oldAllocation = abi.decode(data, (uint256));
        uint256 amountAllocated = _allocate(assets);
        // ...
  • Strategy deallocate() also early-returns under killSwitch, never setting approvals required by the vault’s subsequent transferFrom:
Solidity
130:145:src/MYTStrategy.sol
        if (killSwitch) {
            return (ids(), int256(0));
            /* ... */
        }
        require(assets > 0, "Zero amount");
        uint256 oldAllocation = abi.decode(data, (uint256));
        uint256 amountDeallocated = _deallocate(assets);
        // ...
  • The example strategy reports only ERC4626 position as realAssets() and ignores idle tokens stranded on the adapter:
Solidity
43:45:src/strategies/mainnet/PeapodsUSDC.sol
function realAssets() external view override returns (uint256) {
    return vault.convertToAssets(vault.balanceOf(address(this)));
}
  • Proof-of-concept (non-reverting) shows:
    • Vault calls allocate() → assets move to adapter.
    • killSwitch early-return → allocation unchanged.
    • Adapter holds raw USDC; realAssets() remains 0.
    • Vault’s token balance decreases exactly by the allocated amount.
Solidity
69:109:src/test/strategies/PeapodsUSDCStrategy.t.sol
function test_killSwitch_allocate_leaks_assets_and_misaccounts_no_revert() public {
    uint256 amountToAllocate = 1_000 * 10 ** testConfig.decimals;
    vm.prank(admin);
    IMYTStrategy(strategy).setKillSwitch(true);

    bytes32 id = IMYTStrategy(strategy).adapterId();
    uint256 initialVaultTokenBal = TokenUtils.safeBalanceOf(USDC, vault);
    uint256 initialAdapterTokenBal = TokenUtils.safeBalanceOf(USDC, strategy);
    uint256 initialAlloc = IVaultV2(vault).allocation(id);
    uint256 initialRealAssets = IMYTStrategy(strategy).realAssets();

    assertEq(initialAdapterTokenBal, 0, "adapter start bal");
    assertEq(initialRealAssets, 0, "realAssets start");
    assertEq(initialAlloc, 0, "alloc start");

    vm.startPrank(allocator);
    IVaultV2(vault).allocate(strategy, abi.encode(initialAlloc), amountToAllocate);
    vm.stopPrank();

    assertEq(TokenUtils.safeBalanceOf(USDC, strategy), amountToAllocate, "adapter raw assets");
    assertEq(IMYTStrategy(strategy).realAssets(), 0, "realAssets still zero");
    assertEq(IVaultV2(vault).allocation(id), initialAlloc, "alloc unchanged");
    assertEq(
        TokenUtils.safeBalanceOf(USDC, vault),
        initialVaultTokenBal - amountToAllocate,
        "vault token bal decreased"
    );
}

Why this is dangerous:

  • Funds are effectively stuck on the adapter until owner action, and vault exits via deallocate() revert due to missing approvals.
  • realAssets() excludes the stranded tokens, so the next accrueInterest() realizes a loss (share price drop) despite funds not actually being deployed.
  • Allocations and caps remain inconsistent (no increase in allocation despite asset movement), undermining vault risk controls.

Impact Details

  • Loss realization: Next accrual sets totalAssets to a value excluding stranded tokens → share price decreases, harming depositors.
  • Exit DOS: Vault deallocate() reverts (adapter didn’t approve), preventing liquidity retrieval during emergency.
  • Allocation/cap inconsistency: Allocations unchanged while assets moved, weakening risk caps and accounting invariants.
  • Governance/safety friction: Enabling killSwitch (intended for emergencies) paradoxically leaks funds to the adapter and blocks emergency exits.

Severity: High.

Recommended Remediation

  • In allocate() when killSwitch == true, refund immediately to the vault and return zero change:
Solidity
if (killSwitch) {
    address asset_ = IVaultV2(address(MYT)).asset();
    IERC20(asset_).transfer(msg.sender, assets); // msg.sender is the vault
    return (ids(), int256(0));
}
  • In deallocate() when killSwitch == true, approve the vault to pull and return the correct negative change (or avoid early-return and perform approvals first):
Solidity
if (killSwitch) {
    address asset_ = IVaultV2(address(MYT)).asset();
    IERC20(asset_).approve(msg.sender, assets);
    uint256 oldAllocation = abi.decode(data, (uint256));
    uint256 newAllocation = oldAllocation - assets;
    return (ids(), int256(newAllocation) - int256(oldAllocation));
}
  • Count idle tokens in realAssets() to avoid loss realization when funds are temporarily held idle on the adapter (strategy-specific):
Solidity
function realAssets() external view override returns (uint256) {
    return vault.convertToAssets(vault.balanceOf(address(this)))
        + TokenUtils.safeBalanceOf(address(usdc), address(this));
}

References

  • Vault transfers then calls allocate:
Solidity
572:589:lib/vault-v2/src/VaultV2.sol
        SafeERC20Lib.safeTransfer(asset, adapter, assets);
        (bytes32[] memory ids, int256 change) = IAdapter(adapter).allocate(data, assets, msg.sig, msg.sender);
        // ...
  • Strategy allocate() killSwitch early-return:
Solidity
113:121:src/MYTStrategy.sol
        if (killSwitch) {
            return (ids(), int256(0));
        }
        // ...
  • Strategy deallocate() killSwitch early-return:
Solidity
130:145:src/MYTStrategy.sol
        if (killSwitch) {
            return (ids(), int256(0));
            /* ... */
        }
        // ...
  • Strategy realAssets() excludes idle:
Solidity
43:45:src/strategies/mainnet/PeapodsUSDC.sol
function realAssets() external view override returns (uint256) {
    return vault.convertToAssets(vault.balanceOf(address(this)));
}
  • PoC test (non-reverting, calls VaultV2.allocate()):
Solidity
69:109:src/test/strategies/PeapodsUSDCStrategy.t.sol
function test_killSwitch_allocate_leaks_assets_and_misaccounts_no_revert() public {
    // ...
}

Link to Proof of Concept

https://gist.github.com/IronsideSec/52387980717c94bdd092cfa847883fce

Proof of Concept

Proof of Concept

The original report as published on Immunefi, by IronsideSec. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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 killSwitch early-return paths in allocate() and deallocate() skip the token refund and approval steps that the vault's transfer-then-call flow depends on.

Impact

Funds could be stuck on the adapter until the owner acts, the next accrual may realise a loss through a share price drop, and vault deallocate() reverts, blocking emergency exits.

What the attacker needed

Admin enables killSwitch; allocator calls vault allocate()

The fix

The strategy should refund assets to the vault in allocate() under killSwitch, approve the vault in deallocate() under killSwitch, and count idle tokens in realAssets().

How it was found

  1. Enable the killSwitch on the strategy as the admin.
  2. Call the vault's allocate() for the strategy as the allocator.
  3. Observe the adapter now holds the raw tokens while realAssets() stays zero and the allocation is unchanged.
  4. Observe the vault's token balance decreased by the allocated amount.

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 vault passes money to a strategy contract, which is meant to invest it. A safety switch called killSwitch is supposed to stop the strategy, but here it makes the strategy return without doing anything, so the money sits in the wrong place and the vault's records no longer match reality. Later attempts to pull the money back fail, so users could be unable to withdraw.

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.

More by IronsideSec

View all

28 more disclosed reports, best first.

More from Alchemix V3

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.