Skip to content
Business logic Audit finding Intermediate

Allocate assets in killswitch mode can lead to assets stuck on contract

When the strategy's kill switch is enabled, its allocate function returns early without using the assets, but the vault has already transferred the assets to the strategy. An allocator (or a user minting) could therefore cause funds to be sent to the strategy contract and become stuck there.

ox9527 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

56516 sc high allocate assets in killswitch mode can lead to assets stuck on contract

Submitted on Oct 17th 2025 at 07:24:05 UTC by @ox9527 for Audit Comp | Alchemix V3

Description

Brief/Intro

The MYTStrategy.sol::allocate() function is invoked by two functions within the Morpho V2 vault:

  • VaultV2.sol::mint() -> enter() -> allocateInternal() -> allocate()
  • VaultV2.sol::allocate() -> allocateInternal() -> allocate()

Note that mint() is a public function, while allocate() can only be called by users with the Allocator role.

In MYTStrategy.sol::allocate(), there is a kill switch / emergency mode. When the kill switch is active (killSwitch == true), the function immediately returns without performing any allocation logic:

Solidity
    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));  <@
        }

However, in both mint() and allocate() flows, before calling allocate(), the vault already transfers assets to the strategy via allocateInternal:

Solidity
    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);

As a result, when the kill switch is active, the assets are transferred from the vault to MYTStrategy.sol, but since allocate() returns (ids(), 0), the assets are never utilized or recorded, leading to them becoming stuck in the MYTStrategy.sol contract.

Vulnerability Details

Above

Impact Details

assests stuck in contract when allocate() is called by public users/Allocator

References

https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/MYTStrategy.sol?utm_source=immunefi#L107-L109

Proof of Concept

Proof of Concept

add test to file AlchemistAllocator.t.sol

Solidity
    function test_POC1() public {
        address alice = address(0x1001);

        _magicDepositToVault(address(vault), alice, 150 ether);

        vm.startPrank(admin);
        bytes32 allocationId = mytStrategy.adapterId();
        allocator.allocate(address(mytStrategy), 100 ether);

        //set Emergency.
        mytStrategy.setKillSwitch(true);

        //allocare another 50 ether
        allocator.allocate(address(mytStrategy), 50 ether);
        vm.stopPrank();

        //check cap.
        uint256 allocation = vault.allocation(allocationId);

        assertEq(allocation, 100 ether);
    }

The original report as published on Immunefi, by ox9527. 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 vault transfers assets to the adapter before calling allocate, and the strategy's kill-switch path returns early without rejecting or refunding the transfer.

Impact

Assets sent to the strategy while the kill switch is active could become permanently stuck in the strategy contract.

What the attacker needed

Allocator role or a user minting; kill switch enabled on the strategy

The fix

The strategy should reject or refund the transfer when the kill switch is active, or the vault should check the kill switch before transferring assets.

How it was found

  1. Deposit into the vault as a user.
  2. As the allocator, allocate part of the funds to the strategy.
  3. Enable the strategy's kill switch.
  4. Allocate more funds to the strategy while the kill switch is on.
  5. Observe the vault's recorded allocation does not increase, while the assets were already sent to the strategy.

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 helper contract (the strategy) and then asks it to invest that money. If the strategy is in an emergency 'stop' mode, it refuses to invest but the money has already arrived, so it just sits there. The report shows this leaves the funds stranded in the strategy.

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 ox9527

View all

13 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.