58787 sc medium when allocation amount is greater than the maxdeposit of tokeautoeth sol the remaining is stuck in tokeautoeth sol
Submitted on Nov 4th 2025 at 13:40:07 UTC by @kaysoft for Audit Comp | Alchemix V3
Report ID: #58787
Report Type: Smart Contract
Report severity: Medium
Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/strategies/mainnet/TokeAutoEth.sol
Impacts:
Temporary freezing of funds for at least 1 hour
Description
Brief/Intro
The autoEth contract of Tokemac has a maxDeposit cap amount for each addrress when unlocking profit.
When allocation amount is greater than the maxDeposit of TokeAutoETh.sol, the remaining is stuck in TokeAutoEth.sol
This will allow depositors in VaultV2 after this lock, to mint more shares than expected when these remaining WETH is left in the TokeAutoEth.sol because the totalAssets() function of VaultV2.sol does not account for locked WETH on strategy making the denomenator for shares minting smaller.
This allows them to withdraw more leading to loss for earlier depositors.
Vulnerability Details
The _allocate(...) function in the TokeAutoETh.sol function, calls router.depositMax(autoEth, address(this), 0) to deposit the maximum amount allowed to the particular autoEth vault.
The issue is that if the amount sent to the TokeAutoEth.sol from VaultV2.allocate(...) function is more than the autoEth.maxDeposit, only the autoEth.maxDepositfor the strategy will be pulled and deposited and the remaining will be left in the TokeAutoEth.sol contract.
As can be seen above the router.depositMax(autoEth, address(this), 0) call in the _allocate(...) functon of the TokeAutoEth.sol will not deposit all the amount if maxDeposit is smaller. This leaves the remaining WETH stuck in the TokeAutoEth.sol.
Impact Details
Remaining Asset from maxDeposit is stuck in the TokeAutoEth.sol when allocation amount is greater.
Subsequent depositors to VaultV2 mint more shares because stuck asset in Strategy is not accounted for when VaultV2.totalAsset() is calcaulted for shares minting. This means these depositors will with withdraw more assets with this inflated shares.
Recommendation
Consider checking the autoEth.maxDeposit(strat) amount for the strategy first before calling router.depositMax(...) function and handle the remaining if there is any
Proof of Concept
Proof of Concept
Create a file named POC.t.sol in the
src/test/strategies/POC.t.soldirectoryRun
forge test --match-test test_allocate_depositCap
Was this helpful?