> For the complete documentation index, see [llms.txt](https://reports.immunefi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://reports.immunefi.com/alchemix-v3/57849-sc-high-funds-gets-stuck-even-when-killswitch-is-enabled.md).

# 57849 sc high funds gets stuck even when killswitch is enabled

**Submitted on Oct 29th 2025 at 08:03:41 UTC by @shadowHunter for** [**Audit Comp | Alchemix V3**](https://immunefi.com/audit-competition/alchemix-v3-audit-competition)

* **Report ID:** #57849
* **Report Type:** Smart Contract
* **Report severity:** High
* **Target:** <https://github.com/alchemix-finance/v3-poc/blob/immunefi\\_audit/src/MYTStrategy.sol>
* **Impacts:**
  * Temporary freezing of funds for at least 1 hour

## Description

## Brief/Intro

Even if `killSwitch` is enabled by Owner, funds gets transferred from Vault to Adaptor in case of allocation. These funds remain stuck with no way to deallocate until `killSwitch` is turned off

## Vulnerability Details

* If `killSwitch` is true on MYTStrategy and allocation is done then `MYTStrategy` correctly make 0 changes

```
if (killSwitch) {
            return (ids(), int256(0));
        }
```

* But still Morpho vault which ignores if any changes were made to id, will send funds from vault to the MYTStrategy adaptor. This should be unexpected

```
https://github.com/morpho-org/vault-v2/blob/406546763343b9ffa84c2f63742ae55a490b7c42/src/VaultV2.sol#L576
function allocateInternal(address adapter, bytes memory data, uint256 assets) internal {
        require(isAdapter[adapter], ErrorsLib.NotAdapter());

        accrueInterest();

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

* Also now you cannot deallocate this stuck funds until owner turns kill switch off which may not even happen (since adaptor does not approve funds to vault due to early exit)

```
 function deallocate(bytes memory data, uint256 assets, bytes4 selector, address sender)
        external
        onlyVault
        returns (bytes32[] memory strategyIds, int256 change)
    {
        if (killSwitch) {
            return (ids(), int256(0));
        }
```

## Impact Details

Funds get stuck in adaptor

## Recommendation

Allocator should not call vault if kill switch is enabled

## Proof of Concept

## Proof of Concept

Place this in `MYTStrategy.t.sol` test suit

```
function test_killSwitchPreventsAllocation() public {
        //  Enable kill switch
         vm.prank(admin);
         strategy.setKillSwitch(true);

        //  Vault should fail to allocate
         vm.prank(address(vault));
         vm.expectRevert(bytes("emergency"));
         strategy.allocate(abi.encode(0), 100e18, bytes4(0x00000000), address(allocator));
     }
```

Ouput:

```
Encountered 1 failing test in src/test/MYTStrategy.t.sol:MYTStrategyTest
[FAIL: next call did not revert as expected] test_killSwitchPreventsAllocation() (gas: 50021)

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://reports.immunefi.com/alchemix-v3/57849-sc-high-funds-gets-stuck-even-when-killswitch-is-enabled.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
