Skip to content
Business logic Audit finding Intermediate

Permanent freezing of tokeautoeth strategy rewards in myt vault

The TokeAutoEth strategy sends claimed TOKE rewards to the MYT vault, which has no way to withdraw or transfer them, so the rewards become permanently stuck. Anyone can trigger the claim, so rewards can be frozen at any time.

call_me_rp Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

58357 sc low permanent freezing of tokeautoeth strategy rewards in myt vault

Submitted on Nov 1st 2025 at 15:21:56 UTC by @call_me_rp for Audit Comp | Alchemix V3

Description

Summary

Rewards generated by the TokeAutoEth strategy are claimed into the MYT vault (address(MYT)). Once received or staked under the MYT address, these rewards (TOKE token) cannot be withdrawn, transferred, or reallocated. As a result, all rewards are permanently stuck in the MYT contract.

Description

When claimRewards() is called, the strategy executes:

Solidity
MYTStrategy.sol::
    function claimRewards() public virtual returns (uint256) {
        require(!killSwitch, "emergency");
        _claimRewards();
    }

It calls into TokeAutoEth.sol::
    function _claimRewards() internal override returns (uint256 rewardsClaimed) {
        rewardsClaimed = rewarder.earned(address(this));
>>      rewarder.getReward(address(this), address(MYT), false); // transfer all TOKE token rewards to morpho vault or get staked on myt address
    }

  • The Tokemak rewarder then either transfers the TOKE tokens or stakes them with recipient = address(MYT):

[Link to Tokemak rewarder code]](https://github.com/Tokemak/v2-core-pub/blob/de163d5a1edf99281d7d000783b4dc8ade03591e/src/rewarders/AbstractRewarder.sol#L306C4-L331C6)

Solidity
    function _getReward(address account, address recipient) internal {
        ...

        // if NOT toke, or staking is turned off (by duration = 0), just send reward back
        if (rewardToken != tokeAddress || tokeLockDuration == 0) {
            rewards[account] = 0;
            emit RewardPaid(account, recipient, reward);

>>          IERC20(rewardToken).safeTransfer(recipient, reward); // transfer tokens to myt
        } else if (accToke.isStakeableAmount(reward)) {
            rewards[account] = 0;
            emit RewardPaid(account, recipient, reward);
            // authorize accToke to get our reward Toke
            LibAdapter._approve(IERC20(tokeAddress), address(accToke), reward);

            // stake Toke
>>          accToke.stake(reward, tokeLockDuration, recipient); // Or stake token as myt as owner
        }
    }

Since the MYT vault has no functionality to transfer, withdraw, or re-allocate these TOKE rewards, all claimed rewards becomes permanently locked.

Additionally, anyone can call claimRewards(), meaning the freeze can occur at any time, even if rewards are small and unintended.

Impact

All TOKE rewards generated by the strategy become locked into myt.

Recommendation

Claim rewards to the strategy instead of the MYT vault:

rewarder.getReward(address(this), address(this), false);

Then implement appropriate handling in the strategy:

Optionally swap to underlying asset, OR sends to owner

Introduce unstake() too to get staked toke.

Proof of Concept

Proof of Concept

PoC Summary

Since the real rewarder contract on mainnet distributes rewards based on live protocol state, the test environment cannot naturally reproduce accrued rewards. To demonstrate the issue in isolation, we replaced the rewarder contract implementation at its address using vm.etch and pointed its rewardToken storage slot to a mock ERC20 token. The mock rewarder is intentionally minimal and always returns a fixed reward amount (5e18) for earned() and sends that amount in getReward().

By doing this, we simulate the presence of claimable rewards without altering the whole rewarder logic. When claimRewards() is executed, the adapter puts recipient as myt, and then those reward token(TOKE token) will always stuck in vault/MYT.

  1. Add below test case and interfaces into TokeAutoEthStrategy.t.sol:
Solidity
import {TestERC20} from "../mocks/TestERC20.sol";

interface IERC20 {
    function approve(address spender, uint256 amount) external returns (bool);
    function balanceOf(address a) external view returns (uint256);
    function transfer(address to, uint256 amount) external returns (bool);
}

interface IBaseRewarder {
    function getReward(address account, address recipient, bool claimExtras) external;
    function earned(address account) external view returns (uint256);
    function rewardToken() external view returns (IERC20);
}

contract MockRewarder is IBaseRewarder {
    /// @notice The reward token distributed by the rewarder(TOKE token)
    IERC20 public rewardToken;

    mapping(address account => uint256) private _balances;

    constructor(IERC20 _rewardToken) {
        rewardToken = _rewardToken;
    }

    /// @notice Always return 5e18 as "earned" — simulates pending rewards
    function earned(address account) external view override returns (uint256) {
        return 5e18;
    }

    /// @notice Sends 5e18 reward tokens to the vault (recipient -> myt)
    function getReward(address account, address recipient, bool claimExtras) external override {
        IERC20(rewardToken).transfer(recipient, 5e18);
    }

    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

}

    function test_rewards_stuck_into_myt() public {
        // --- Setup: Allocate funds into the strategy ---
        uint256 amountToAllocate = 100 ether;
        vm.startPrank(vault);
        deal(testConfig.vaultAsset, strategy, amountToAllocate);
        bytes memory prevAllocationAmount = abi.encode(0);
        IMYTStrategy(strategy).allocate(prevAllocationAmount, amountToAllocate, "", address(vault));
        vm.stopPrank();

        IBaseRewarder rewarder = IBaseRewarder(REWARDER);

        vm.startPrank(address(rewarder));
        // --- Step 1: Deploy a mock reward token (this simulates the underlying protocol reward token) ---
        TestERC20 rewardToken = new TestERC20(100e18, 18);
        vm.stopPrank();

        // --- Step 2: Deploy our MockRewarder which always "returns" 5e18 earned ---
        MockRewarder mock = new MockRewarder(IERC20(address(rewardToken)));

        // --- Step 3: Overwrite the real rewarder contract code with our mock implementation ---
        vm.etch(REWARDER, address(mock).code);

        // --- Step 4: Patch storage so MockRewarder.rewardToken points to our mock reward token ---
        // rewardToken is the FIRST storage slot in MockRewarder → slot index = 0
        vm.store(
            REWARDER,
            bytes32(uint256(0)),
            bytes32(uint256(uint160(address(rewardToken))))
        );

        // --- Step 5: Fund the rewarder so 'getReward()' can actually transfer tokens ---
        deal(address(rewardToken), REWARDER, 10 ether);

        // --- Step 6: Trigger the strategy reward claiming logic ---
        IMYTStrategy(strategy).claimRewards();

        // This shows that rewards end up stuck inside MYT / vault and cannot be recovered.
        uint mytbal= rewardToken.balanceOf(vault);
        assertEq(mytbal, 5e18);
    }

  1. run by forge test --mt test_rewards_stuck_into_myt -vvvv
  2. output:
Solidity
TestERC20::balanceOf(MockMYTVault: [0x522B3294E6d06aA25Ad0f1B8891242E335D3B459]) [staticcall]
    │   └─ ← [Return] 5000000000000000000 [5e18]

The original report as published on Immunefi, by call_me_rp. 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 strategy passes the MYT vault address as the reward recipient, but the vault lacks any mechanism to withdraw or reallocate those tokens.

Impact

All TOKE rewards generated by the strategy become permanently locked in the MYT vault, and anyone can trigger the freeze at any time.

What the attacker needed

Strategy has claimable TOKE rewards; anyone can call claimRewards()

The fix

The strategy should claim rewards to itself and then handle them (swap, send to owner, or unstake), rather than sending them to the vault.

How it was found

  1. Deploy a mock reward token to simulate the protocol reward token.
  2. Deploy a mock rewarder that always reports and sends a fixed reward amount.
  3. Replace the real rewarder contract code with the mock using vm.etch.
  4. Patch the rewarder's storage so its rewardToken points to the mock token.
  5. Fund the rewarder with reward tokens so it can transfer them.
  6. Call claimRewards() on the strategy and observe the reward tokens arriving at the vault address.

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 smart contract strategy earns reward tokens and sends them to a vault contract. That vault has no function to move those tokens out, so they are stuck forever. Because anyone can call the claim function, the tokens can be locked at any moment.

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