Skip to content
Smart contracts Audit finding Intermediate

Funds can become permanently stuck in adapter when kill switch is enabled

When the adapter's kill switch is enabled, the Morpho vault still transfers collateral to the adapter, but the adapter's allocate function returns early without allocating anything. Because there is no recovery path, those funds become permanently stuck in the adapter contract.

mohitisimmortal Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

58215 sc high funds can become permanently stuck in adapter when kill switch is enabled

Submitted on Oct 31st 2025 at 13:01:14 UTC by @mohitisimmortal for Audit Comp | Alchemix V3

Description

Summary:

When killSwitch is enabled in the adapter (MYTStrategy), the adapter does not allocate funds, but the Morpho vault still transfers collateral to the adapter. Because no recovery or fallback mechanism exists, these funds become irrecoverably stuck inside the adapter contract. Disabling killSwitch and attempting deallocate does not help because no allocation took place, so there is nothing to unwind, leaving the vault with a permanent loss.

Description:

  1. Allocation flow:
  • AlchemistAllocator.allocate() → calls Morpho vault.
  • Morpho vault executes allocateInternal().
  • allocateInternal() transfers assets to adapter and then calls the adapter’s allocate() function:
Solidity
function allocateInternal(address adapter, bytes memory data, uint256 assets) internal {
        ...

>>      SafeERC20Lib.safeTransfer(asset, adapter, assets); // Morpho sends assets to adapter 
        (bytes32[] memory ids, int256 change) = IAdapter(adapter).allocate(data, assets, msg.sig, msg.sender);
        ...

        }
  1. Bug condition:

If killSwitch == true in the adapter:

Solidity
MYTStrategy::
function allocate(bytes memory data, uint256 assets, bytes4 selector, address sender)
        external
        onlyVault
        returns (bytes32[] memory strategyIds, int256 change)
    {
        if (killSwitch) {
            return (ids(), int256(0)); // No allocation happens, funds stuck in adapter
        }
        ...
    }

  • The asset transfer still happened, but the adapter does not allocate into any strategy.
  • No recover() or fallback logic exists.
  • Funds remain stuck in the adapter contract.
  • Later, when attempting deallocate(), it fails to return funds because:
    • Nothing was allocated → nothing to unwind → still stuck.

Impact:

Permanent loss/stuck of vault asset.

Likelihood:

  • killswitch is rarely be true, but as many strategies are there, so medium-high likelihood is possible.

Recommendation:

Implement a recovery path for funds when killSwitch is active.

Option A : Add recover() function in adapter:

Option B: Modify allocate() to immediately return transferred funds when killSwitch == true:

Option C: During deallocate(), detect unallocated idle balance and transfer directly back to Morpho vault.

Proof of Concept

Proof of Concept

  • add below import and testcase into AlchemistAllocator.t.sol:
Solidity
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

function testfundsStuckInAdapter() public {
        // Enable kill switch
        vm.prank(admin);
        mytStrategy.setKillSwitch(true);

        _magicDepositToVault(address(vault), user1, 150 ether);
        vm.startPrank(admin);
        allocator.allocate(address(mytStrategy), 100 ether);
        bytes32 allocationId = mytStrategy.adapterId();
        uint256 allocation = vault.allocation(allocationId);
        
        // Now, adapter(strategy) have those funds of morpho vault, and no way to recover those from adapter
        uint256 bal = IERC20(mockVaultCollateral).balanceOf(address(mytStrategy));
        assertEq(bal, 100 ether);

        // if try to deallocate those from adapter, then that also fails in both cases(killswitch or non-killswitch)
        // allocator.deallocate(address(mytStrategy), 50 ether);
        vm.stopPrank();
    }
  • run by forge test --mt testfundsStuckInAdapter -vvvv
  • output:
Solidity
TestERC20::balanceOf(MockMYTStrategy: [0xF62849F9A0B5Bf2913b396098F7c7019b51A820a]) [staticcall]
    │   └─ ← [Return] 100000000000000000000 [1e20]

The original report as published on Immunefi, by mohitisimmortal. 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

The vault transfers assets to the adapter before calling allocate, and the adapter's kill-switch branch returns without allocating or refunding, with no recovery function to retrieve the idle balance.

Impact

Vault assets could be permanently stuck in the adapter, causing a permanent loss to the vault.

What the attacker needed

Kill switch enabled by admin; vault allocates to the adapter

The fix

The adapter should either refund the transferred assets immediately when the kill switch is active, or expose a recovery function (or handle idle balance during deallocate) so the vault can retrieve them.

How it was found

  1. Enable the kill switch on the adapter as admin.
  2. Deposit collateral into the vault for a user.
  3. Call allocate on the allocator for the adapter.
  4. Observe the adapter's collateral balance equals the allocated amount, with no way to recover it.

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 sends money to a helper contract (the adapter) and then asks it to invest that money. If the adapter's emergency stop (the kill switch) is on, it refuses to invest but the money has already arrived, and nothing in the code can send it back. So the money sits there forever.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by mohitisimmortal

View all

1 more disclosed report, 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.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.