Skip to content
DoS Audit finding Intermediate

Unbounded Deposit Exposure in TokeAutoEthStrategy::_allocate()

The strategy's _allocate function calls depositMax, which deposits the entire WETH balance rather than the specified amount. An attacker can send a tiny amount of WETH to the strategy, causing depositMax to revert and blocking allocations.

Josh4324 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

58492 sc medium unbounded deposit exposure in tokeautoethstrategy allocate

Submitted on Nov 2nd 2025 at 17:47:28 UTC by @Josh4324 for Audit Comp | Alchemix V3

Description

Brief/Intro

The _allocate() function in the TokeAutoEthStrategy contract deposits funds into the AutopilotRouter using the following logic:

SOL
function _allocate(uint256 amount) internal override returns (uint256) {
    require(TokenUtils.safeBalanceOf(address(weth), address(this)) >= amount, "Strategy balance is less than amount");
    TokenUtils.safeApprove(address(weth), address(router), amount);
    uint256 shares = router.depositMax(autoEth, address(this), 0);
    TokenUtils.safeApprove(address(autoEth), address(rewarder), shares);
    rewarder.stake(address(this), shares);
    return amount;
}

The function verifies that the contract’s WETH balance is at least amount, but then calls router.depositMax(autoEth, address(this), 0). The depositMax() function deposits all available WETH held by the contract, not just the amount parameter.

If additional tokens are transferred to the strategy contract (e.g., by an attacker), this call will attempt to deposit more than intended. In particular, an attacker can frontrun the allocation transaction by sending a small amount (e.g., 1 wei) of WETH to the strategy, which causes depositMax() to revert internally.

Vulnerability Details

The strategy assumes that _allocate(amount) only deposits amount worth of assets.

However, router.depositMax() ignores this limit and deposits the full contract balance.

Because depositMax() likely computes depositable assets as IERC20(weth).balanceOf(address(this)), if an attacker front-runs the transaction and sends even 1 wei of WETH, it changes the expected amount of tokens to deposit.

This will lead to the transaction to revert and when attack can be repeated when amount pass into allocate is increased.

Impact Details

The strategy may revert indefinitely on subsequent _allocate() calls, blocking allocations.

References

https://github.com/alchemix-finance/v3-poc/blob/immunefi\\_audit/src/strategies/mainnet/TokeAutoEth.sol#L56

Proof of Concept

Copy the test into src/test/strategies/TokeAutoETHStrategy.t.sol Run forge test --mt test_strategy2 -vvvv

SOL
function test_strategy2() public {
        uint256 amountToAllocate = 50e18;

        // Attacker adds 1 wei to the strategy
        deal(testConfig.vaultAsset, strategy, 50e18 + 1);

        console.log(IERC20(testConfig.vaultAsset).balanceOf(address(strategy)));

        // Vault allocates normally
        vm.startPrank(vault);
        bytes memory prevAllocationAmount = abi.encode(0);
        IMYTStrategy(strategy).allocate(prevAllocationAmount, amountToAllocate, "", address(vault));

        vm.stopPrank();
    }

The original report as published on Immunefi, by Josh4324. 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 _allocate function uses depositMax which deposits the entire WETH balance instead of the intended amount, so any extra WETH causes a mismatch and revert.

Impact

The strategy may revert indefinitely on subsequent _allocate() calls, blocking allocations and causing temporary freezing of funds for at least 24 hours.

What the attacker needed

Attacker can send WETH to the strategy; attacker can frontrun the allocation transaction

The fix

The _allocate function should deposit only the specified amount, not use depositMax, or should account for extra balance.

How it was found

  1. Attacker sends a small amount of WETH (e.g., 1 wei) to the strategy contract.
  2. The vault calls allocate with a specified amount.
  3. The strategy's _allocate calls depositMax, which attempts to deposit the entire balance including the extra WETH.
  4. The depositMax call reverts, causing the allocation to fail.

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 is supposed to deposit only a specific amount of a token into another contract. But it uses a function that deposits everything it holds. If someone sends even a tiny extra amount of that token to the strategy, the deposit function fails and the strategy cannot allocate funds.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by Josh4324

View all

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

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.