Skip to content
Smart contracts Audit finding Intermediate

Claimwithdrawalqueue discards claimed amount

The public claimWithdrawalQueue function in MYTStrategy does not return the amount produced by the internal _claimWithdrawalQueue hook, so callers always receive zero. This could cause vault accounting to believe nothing was claimed, leading to stalled exits or double-withdraw attempts.

OxPrince Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

56518 sc insight claimwithdrawalqueue discards claimed amount

Submitted on Oct 17th 2025 at 07:50:56 UTC by @OxPrince for Audit Comp | Alchemix V3

Description

Brief/Intro

MYTStrategy.claimWithdrawalQueue declares a return value but drops the amount produced by the strategy-specific _claimWithdrawalQueue. Extenders such as SfrxETHStrategy correctly compute and return the assets they redeemed, yet callers of the public entrypoint always receive 0.

Vulnerability Details

claimWithdrawalQueue at src/MYTStrategy.sol:143-148 does not capture the value returned by _claimWithdrawalQueue, so the Solidity default return value 0 is forwarded. The interface IMYTStrategy.claimWithdrawalQueue explicitly promises a uint256 return, and concrete strategies (e.g., SfrxETHStrategy._claimWithdrawalQueue at src/strategies/SfrxETH.sol:72-82) produce a meaningful amount that is never surfaced to the caller.

Impact Details

vault accounting that relies on the returned amount (per the IMYTStrategy interface) will conclude that nothing was claimed, even while assets were actually withdrawn. That leads to stalled exit flows, double-withdraw attempts, or failure to re-integrate newly received assets into vault accounting. In the worst case, downstream code may revert because it believes there are no funds to settle, effectively freezing allocators until manual intervention.

References

Add any relevant links to documentation or code

Proof of Concept

Proof of Concept

Solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import "forge-std/Test.sol";
import {stdError} from "forge-std/StdError.sol";
import {MYTStrategy} from "../MYTStrategy.sol";
import {IMYTStrategy} from "../interfaces/IMYTStrategy.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";

contract MYTStrategyBaseTest is Test {
    MockERC20 internal asset;
    MockERC20 internal receipt;
    MockVault internal vault;
    MYTStrategy internal strategy;

    function setUp() public {
        asset = new MockERC20("Asset", "ASSET", 18);
        receipt = new MockERC20("Receipt", "RECEIPT", 18);
        vault = new MockVault(asset);

        IMYTStrategy.StrategyParams memory params = IMYTStrategy.StrategyParams({
            owner: address(this),
            name: "Base Strategy",
            protocol: "Test Protocol",
            riskClass: IMYTStrategy.RiskClass.LOW,
            cap: 0,
            globalCap: 0,
            estimatedYield: 0,
            additionalIncentives: false,
            slippageBPS: 0
        });

        strategy = new MYTStrategy(address(vault), params, address(0x1234), address(receipt));
    }

    function test_baseHooksLeaveVaultUnableToRecoverAssets() public {
        uint256 amount = 10 ether;

        asset.mint(address(vault), amount);

        vault.allocate(address(strategy), amount);

        assertEq(asset.balanceOf(address(strategy)), amount, "strategy did not retain the transfer");
        assertEq(vault.currentAllocation(address(strategy)), 0, "allocation should remain zero with empty hooks");

        vm.expectRevert(stdError.arithmeticError);
        vault.deallocate(address(strategy), amount);
    }
}

contract ClaimValueStrategy is MYTStrategy {
    uint256 public claimValue;
    uint256 public lastInternalClaim;

    constructor(address _myt, StrategyParams memory _params, address _permit2Address, address _receiptToken)
        MYTStrategy(_myt, _params, _permit2Address, _receiptToken)
    {}

    function setClaimValue(uint256 newValue) external {
        claimValue = newValue;
    }

    function _claimWithdrawalQueue(uint256) internal override returns (uint256) {
        lastInternalClaim = claimValue;
        return claimValue;
    }
}

contract ClaimWithdrawalQueueReturnTest is Test {
    ClaimValueStrategy internal strategy;

    function setUp() public {
        MockERC20 asset = new MockERC20("Asset", "ASSET", 18);
        MockVault vault = new MockVault(asset);
        MockERC20 receipt = new MockERC20("Receipt", "RECEIPT", 18);

        IMYTStrategy.StrategyParams memory params = IMYTStrategy.StrategyParams({
            owner: address(this),
            name: "Claim Strategy",
            protocol: "Test Protocol",
            riskClass: IMYTStrategy.RiskClass.LOW,
            cap: 0,
            globalCap: 0,
            estimatedYield: 0,
            additionalIncentives: false,
            slippageBPS: 0
        });

        strategy = new ClaimValueStrategy(address(vault), params, address(0x1234), address(receipt));
        strategy.setWhitelistedAllocator(address(this), true);
    }

    function test_claimWithdrawalQueue_returnsZero() public {
        strategy.setClaimValue(5 ether);

        uint256 returnedAmount = strategy.claimWithdrawalQueue(1);

        assertEq(strategy.lastInternalClaim(), 5 ether, "internal hook should record claimed value");
        assertEq(returnedAmount, 0, "external call incorrectly returns zero");
    }
}

contract MockVault {
    MockERC20 public immutable asset;
    mapping(address => uint256) private allocations;

    constructor(MockERC20 _asset) {
        asset = _asset;
    }

    function allocate(address strategy, uint256 amount) external {
        bytes memory data = abi.encode(allocations[strategy]);
        asset.transfer(strategy, amount);
        (, int256 change) = IMYTStrategy(strategy).allocate(data, amount, this.allocate.selector, msg.sender);
        allocations[strategy] = _applyChange(allocations[strategy], change);
    }

    function deallocate(address strategy, uint256 amount) external {
        bytes memory data = abi.encode(allocations[strategy]);
        (, int256 change) = IMYTStrategy(strategy).deallocate(data, amount, this.deallocate.selector, msg.sender);
        allocations[strategy] = _applyChange(allocations[strategy], change);
        asset.transferFrom(strategy, address(this), amount);
    }

    function currentAllocation(address strategy) external view returns (uint256) {
        return allocations[strategy];
    }

    function _applyChange(uint256 current, int256 change) internal pure returns (uint256) {
        if (change > 0) {
            return current + uint256(change);
        } else if (change < 0) {
            return current - uint256(-change);
        }
        return current;
    }
}

The original report as published on Immunefi, by OxPrince. 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 public function omits the return statement, so the default zero value is returned instead of the internal hook's result.

Impact

Vault accounting that relies on the returned amount could conclude nothing was claimed, potentially stalling exit flows or causing double-withdraw attempts, and in the worst case freezing allocators until manual intervention.

What the attacker needed

A strategy that overrides _claimWithdrawalQueue

The fix

The public claimWithdrawalQueue function should capture and return the value from _claimWithdrawalQueue.

How it was found

  1. Deploy a strategy that overrides _claimWithdrawalQueue to return a non-zero amount.
  2. Set the internal claim value to 5 ether.
  3. Call the public claimWithdrawalQueue function.
  4. Observe that the internal hook records 5 ether but the public call returns 0.

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 function is supposed to tell the caller how many assets were claimed from a withdrawal queue. Because the code forgets to pass along the real number, it always says zero. Other parts of the system that trust this number may think no assets were claimed and behave incorrectly.

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 OxPrince

View all

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

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.