56706 sc medium stargateethpoolstrategy incomplete eth wrapping causes withdrawal dos

Submitted on Oct 19th 2025 at 17:44:12 UTC by @jayx for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #56706

  • Report Type: Smart Contract

  • Report severity: Medium

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

  • Impacts:

    • Temporary freezing of funds for at least 1 hour

Description

Brief/Intro

The StargateEthPoolStrategy._deallocate() function only wraps freshly redeemed ETH into WETH, ignoring pre-existing ETH dust in the contract. When users attempt withdrawals, the function correctly verifies that total available ETH (redeemed + pre-existing) meets requirements, but then only wraps the newly redeemed portion before asserting WETH balance sufficiency. This causes transactions to revert with "Strategy balance is less than the amount needed" despite having adequate total liquidity, creating a DoS condition that temporarily freezes user funds until manual intervention.

Vulnerability Details

The bug exists in StargateEthPoolStrategy._deallocate() at the ETH wrapping logic:

uint256 ethBalanceBefore = address(this).balance;  // Captures pre-existing ETH dust
pool.redeem(lpNeeded, address(this));
uint256 ethBalanceAfter = address(this).balance;
uint256 ethRedeemed = ethBalanceAfter - ethBalanceBefore;

if (ethRedeemed + ethBalanceBefore >= amount) {  // ✅ Correctly checks total ETH
    weth.deposit{value: ethRedeemed}();  // ❌ Only wraps ethRedeemed, not total needed
}

require(TokenUtils.safeBalanceOf(address(weth), address(this)) >= amount);  // ❌ Reverts

ETH Dust Accumulation Source:

Allocations round down to 1e12 multiples, leaving up to 999,999,999,999 wei of unwrapped ETH per allocation:

Impact Details

This causes temporary freezing of funds for at least 1 hour through DoS on withdrawals:

Frequency: Triggers on virtually every withdrawal when dust exists. Dust accumulates naturally from all non-1e12-multiple allocations (nearly 100% of allocations). The fuzz test confirms this occurs reliably across 256 random scenarios.

User Impact:

  • Withdrawal transactions revert despite sufficient liquidity

  • Funds locked until admin manually wraps dust ETH or user reduces withdrawal amount

  • In production, could persist for hours or days depending on monitoring

References

https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/strategies/optimism/StargateEthPoolStrategy.sol#L68C8-L79C134

Proof of Concept

Proof of Concept

run the test_deallocate_reverts_when_total_eth_sufficient_but_dust_not_wrapped test

Was this helpful?