An attacker can prevent any tokenauto strategy allocation by making a donation to the vault of as little as 1 wei of underlying token
The TokenAuto strategy approves only the exact allocation amount to the router, but the router's depositMax function tries to pull the strategy's entire token balance. An attacker can donate 1 wei of the underlying token to the strategy, making its balance exceed any future allocation amount and causing every allocation attempt to revert.
- Disclosed after under an hour
58730 sc medium an attacker can prevent any tokenauto strategy allocation by making a donation to the vault of as little as 1 wei of underlying token
Submitted on Nov 4th 2025 at 10:05:58 UTC by @niroh for Audit Comp | Alchemix V3
- Report ID: #58730
- Report Type: Smart Contract
- Report severity: Medium
- Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi\\_audit/src/strategies/mainnet/TokeAutoUSDStrategy.sol
- Impacts:
- Smart contract unable to operate due to lack of token funds
Description
Brief/Intro
TokenAuto strategies (both USDC and Eth) use the router's depositMax function for deposits. depositMax tries to deposit the entire underlying token balance of the depositor, assuming the router is approved on the full balance:
//From AutopilotRouter.sol depositMax
function depositMax(
IAutopool vault,
address to,
uint256 minSharesOut
) public payable override returns (uint256 sharesOut) {
IERC20 asset = IERC20(vault.asset());
uint256 assetBalance = asset.balanceOf(msg.sender);
uint256 maxDeposit = vault.maxDeposit(to);
uint256 amount = maxDeposit < assetBalance ? maxDeposit : assetBalance;
pullToken(asset, amount, address(this));
approve(IERC20(vault.asset()), address(vault), amount);
return deposit(vault, to, amount, minSharesOut);
}
//From Autopool4626.sol transferAndMint function:
baseAsset.safeTransferFrom(msg.sender, address(this), assets);
Vulnerability Details
The issue is in the fact that the TokenAuto strategies only approve the given allocation amount in _allocate:
//From TokeAutoUSDStrategy
function _allocate(uint256 amount) internal override returns (uint256) {
require(TokenUtils.safeBalanceOf(address(usdc), address(this)) >= amount, "Strategy balance is less than amount");
TokenUtils.safeApprove(address(usdc), address(router), amount); //Audit Comment: only `amount` is approved
uint256 shares = router.depositMax(autoUSD, address(this), 0);
TokenUtils.safeApprove(address(autoUSD), address(rewarder), shares);
rewarder.stake(address(this), shares);
return amount;
}
This means that if the strategy balance is more than the requested allocation (even by as little as one wei) the allocation transaction fails.
This enables an exploit whereby an attacker donates 1 wei of underlying token to the AutoToken strategy as soon as it is deployed. This is enough to brick any future allocation to that strategy. Since the donation can not be deallocated (as it was never allocated) nor swiped from the strategy in any way, it remains there indefinitely. Any attempt to allocate to the strategy will fail because whatever amount is attempted, the strategy balance will be 1 wei higher and therefore the allocation will fail.
Impact Details
Inability of Auto Token strategy contract to operate as no funds can be allocated to it.
References
Proof of Concept
Proof of Concept
How to run:
- Copy the code below into the TokeAutoUSDStrategyTest contract in /v3-poc/src/test/strategies/TokeAutoUSDStrategy.t.sol
- Change the BaseStrategyTest import to import the entire file:
import "../libraries/BaseStrategyTest.sol";
- run with
FOUNDRY_PROFILE=default forge test --fork-url https://mainnet.gateway.tenderly.co --match-test testBrickAllocation -vvv
function testBrickAllocation() public {
uint256 initialDeposit = getTestConfig().vaultInitialDeposit;
uint256 amountFirstAllocation = initialDeposit / 2;
//make some USDC donation to the Strategy to brick the allocation
deal(USDC,strategy,1);
//Try to allocate (reverts with insufficient allowance
vm.startPrank(allocator);
uint256 oldAllocation = VaultV2(vault).allocation(IMYTStrategy(strategy).adapterId());
bytes memory dataOldAlloc = abi.encode(oldAllocation);
vm.expectRevert(bytes("ERC20: transfer amount exceeds allowance"));
VaultV2(vault).allocate(strategy, dataOldAlloc, amountFirstAllocation);
vm.stopPrank();
//Try commenting out the donation to see that without it the allocation succeeds
}
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 approves only the requested allocation amount, but the router's depositMax function attempts to transfer the strategy's full token balance, so any extra balance causes an allowance failure.
Impact
The strategy cannot receive any allocation, so it is unable to operate and the donated token remains stuck indefinitely.
What the attacker needed
Strategy deployed; attacker can send tokens to the strategy
The fix
The strategy should approve the router for the exact amount the router will pull, or the router should pull only the requested amount rather than the full balance.
How it was found
- Deploy the TokenAuto strategy.
- Send 1 wei of the underlying token directly to the strategy contract.
- Call the vault's allocate function for that strategy.
- The allocation reverts because the router tries to transfer more than the approved amount.
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 strategy is a contract that invests funds. To invest, it gives a router permission to take a specific amount of tokens. The router instead tries to take all tokens the strategy holds. If someone sends even a tiny extra amount to the strategy, the router's attempt to take everything exceeds the permission and the whole investment fails.
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.