58257 sc low in tokeautoeth deallocate can be dosed if the vault incuring losses

Submitted on Oct 31st 2025 at 18:58:27 UTC by @OxPhantom for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58257

  • Report Type: Smart Contract

  • Report severity: Low

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

  • Impacts:

    • Permanent freezing of funds

    • Contract fails to deliver promised returns, but doesn't lose value

Description

Brief/Intro

TokeAutoEthStrategy and TokeAutoUSDStrategy can revert during deallocation after a loss because they compute shareDiff = actualSharesHeld - sharesNeeded without guarding sharesNeeded > actualSharesHeld. If the vault price per share has fallen (loss), sharesNeeded can exceed the strategy’s share balance, causing an immediate underflow revert. Even if that check were bypassed, the strategies require returning exactly the requested amount of underlying, which can be impossible post‑loss, forcing top‑ups to succeed.

Vulnerability Details

Both strategies of tokeAuto convert the requested amount of underlying to shares, then subtract from the staked share balance before redeeming. The subtraction is unchecked for ordering and will underflow if the vault suffered losses.

TokeAutoETH:

TokeAutoUSD:

Additionally, the base interface enforces that deallocation must return exactly the requested amount, leaving no room to return less when the vault has losses:

As a result:

  • If sharesNeeded > actualSharesHeld, the subtraction underflows and reverts immediately.

  • Even if clamped later, the require(balance >= amount) will revert after redeeming fewer assets due to losses.

  • An admin could “make it pass” by deallocated a smaller amount but it will however break the accounting since the funds allocated will be inflated.

Impact Details

  • Liveness risk: deallocation can brick under loss scenarios (can’t withdraw), blocking rebalancing/offboarding.

References

https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/strategies/mainnet/TokeAutoEth.sol#L68-L70

Proof of Concept

Proof of Concept

You can run the POC by copy pasting this code in a new test file and run forge test --mt test_Deallocate_poc

Was this helpful?