57861 sc high missing slippage protection in tokemak autopool allocation functions leads to direct theft of user funds

Submitted on Oct 29th 2025 at 09:25:49 UTC by @dray for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #57861

  • Report Type: Smart Contract

  • Report severity: High

  • Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/strategies/mainnet/TokeAutoUSDStrategy.sol

  • Impacts:

    • Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield

Description

Brief/Intro

The TokeAutoUSDStrategy and TokeAutoEthStrategy contracts fail to implement slippage protection when depositing assets into Tokemak Autopools via the AutopilotRouter.depositMax() function. By setting the minSharesOut parameter to zero, the strategies accept any share-to-asset exchange rate, including rates that are significantly unfavorable to users. This enables MEV attackers to sandwich attack deposits, market volatility to cause permanent value loss, and debt reporting timing manipulation to extract value from user funds during the allocation process.

Vulnerability Details

Root Cause

Both TokeAutoUSDStrategy and TokeAutoEthStrategy use the AutopilotRouter.depositMax() function with minSharesOut = 0 during the _allocate() process:

TokeAutoUSDStrategy.sol (Line 45):

TokeAutoEth.sol (Line 59):

The AutopilotRouter interface shows that minSharesOut is designed as a slippage protection parameter:

ITokemac.sol (Line 51):

When minSharesOut = 0, the transaction will succeed regardless of how few shares are received, even if the exchange rate is extremely unfavorable.

Tokemak Documentation Warnings

Tokemak's official integration documentation (https://docs.auto.finance/developer-docs/integrating/4626-compliance) explicitly warns about this:

"Depending on the conditions of the Autopool, the overall market, and the timing of the debt reporting process slippage may be encountered on both entering and exiting the Autopool. It is very important to always check the shares received on entering, and the assets received on exiting, are greater than an expected amount."

The documentation emphasizes that Autopools do not strictly adhere to ERC-4626 specifications regarding slippage, making explicit slippage checks mandatory for integrators.

Why This Occurs

Tokemak Autopools can experience slippage during deposits due to:

  1. Debt Reporting Timing: The Autopool's internal accounting updates at specific intervals. Between updates, the share price may not accurately reflect the true underlying value.

  2. Market Volatility: The underlying LSTs/LRTs (Liquid Staking/Restaking Tokens) can fluctuate in price rapidly, causing the share-to-asset ratio to change between transaction submission and execution.

  3. Rebalancing Operations: When the Autopool rebalances its positions across multiple destinations (DEXs, lending markets), the effective share price can temporarily deviate from fair value.

  4. Large Deposits/Withdrawals: Other users' large transactions can impact the share price before a pending transaction executes.

Impact Details

The vulnerability results in direct, permanent loss of user funds during every allocation operation:

  1. Per-Transaction Loss: For each deposit, users receive fewer shares than their assets are worth. If slippage is 1%, a $1,000,000 deposit loses $10,000 in value immediately.

  2. Cumulative Loss: As the Alchemist protocol processes multiple deposits over time, losses compound. With frequent rebalancing or new deposits, total losses can reach significant amounts.

  3. Impossible Recovery: Once shares are minted at an unfavorable rate, the loss is permanent and cannot be recovered. The user's position is worth less than their deposit from that moment forward.

References

Documentation

  • Tokemak 4626 Compliance Guide: https://docs.auto.finance/developer-docs/integrating/4626-compliance

    • Explicitly states: "It is very important to always check the shares received on entering"

  • Tokemak Integration Documentation: https://docs.auto.finance/developer-docs/integrating

    • Covers Autopool-specific integration requirements

Code References

  • Vulnerable Code:

    • /src/strategies/mainnet/TokeAutoUSDStrategy.sol (Line 45)

    • /src/strategies/mainnet/TokeAutoEth.sol (Line 59)

  • Interface Definition:

    • /src/strategies/interfaces/ITokemac.sol (Line 51)

  • Base Strategy with slippageBPS:

    • /src/MYTStrategy.sol (inherited by both vulnerable strategies)

Proof of Concept

Proof of Concept

Was this helpful?