Skip to content
Business logic Audit finding Intermediate

StargateEthPoolStrategy::_deallocate would emit false deallocating loss event in some cases

When the requested deallocation amount exceeds the contract's LP balance, the code caps the redeem amount to the available balance but still compares the redeemed ETH against the original, larger amount. This causes a false deallocation-loss event to be emitted even though no real loss occurred.

farismaulana Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

56336 sc insight stargateethpoolstrategy deallocate would emit false deallocating loss event in some cases

Submitted on Oct 14th 2025 at 17:17:36 UTC by @farismaulana for Audit Comp | Alchemix V3

Description

Brief/Intro

the _deallocate amount param is capped to lpBalance if the amount param is greater than the contract balance. but the check ethRedeemed < amount is using amount for comparison which is not always the amount used for redeem because the above cap mechanism.

Vulnerability Details

Solidity
    function _deallocate(uint256 amount) internal override returns (uint256) {
        // Compute LP needed ∝ TVL to withdraw `amount` underlying
        // For Stargate, LP tokens are 1:1 with underlying
        // So we can just redeem the amount directly
        uint256 lpBalance = lp.balanceOf(address(this));
        uint256 lpNeeded = amount; // 1:1 ratio

        // Cap at available LP balance
        if (lpNeeded > lpBalance) {
@>          lpNeeded = lpBalance;
        }

        // Redeem LP to native ETH, then wrap back to WETH
        lp.approve(address(pool), lpNeeded);
        uint256 ethBalanceBefore = address(this).balance;
@>      pool.redeem(lpNeeded, address(this));
        uint256 ethBalanceAfter = address(this).balance;
        uint256 ethRedeemed = ethBalanceAfter - ethBalanceBefore;
        // @audit
        if (ethRedeemed < amount) {
            emit StrategyDeallocationLoss("Strategy deallocation loss which includes rounding loss.", amount, ethRedeemed);
        }

here we can see that if the amount assigned to lpNeeded. for some case where it is capped to lpBalance, the redeem call would use this lpBalance that always result in lower ethRedeemed than the amount thus it would always emitting the event which is not necessarily true.

Impact Details

possibly emitting deallocation loss when it is not

References

https://github.com/alchemix-finance/v3-poc/blob/b2e2aba046c36ff5e1db6f40f399e93cd2bdaad0/src/strategies/optimism/StargateEthPoolStrategy.sol#L73-L74

Proof of Concept

Proof of Concept

  1. contract deallocating 100 LP amount
  2. currently the contract is having 99.8 LP amount
  3. cap the amount, and call pool.redeem using 99.8 LP, and get 99.8 ether
  4. check if the ethRedeemed < amount which is 99.8 < 100
  5. emit the deallocation loss event, even though that is all LP token the contract have and no deallocation loss happen

The original report as published on Immunefi, by farismaulana. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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

Likely the loss check compares the redeemed ETH against the original requested amount instead of the capped amount actually redeemed.

Impact

The contract may emit a false deallocation-loss event, which could mislead monitoring or accounting that relies on it.

What the attacker needed

Requested amount exceeds LP balance

The fix

The loss check should compare the redeemed ETH against the capped amount actually redeemed rather than the original requested amount.

How it was found

  1. The contract is asked to deallocate 100 LP.
  2. The contract only holds 99.8 LP.
  3. The amount is capped and the redeem call uses 99.8 LP, returning 99.8 ether.
  4. The code checks whether the redeemed ETH is less than the original amount.
  5. The loss event is emitted even though no loss occurred.

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 contract holds pool tokens and can be asked to withdraw a certain amount. If it is asked for more than it holds, it withdraws everything it has, which is fine. But the code then compares what it got back with the larger amount it was asked for, so it wrongly reports a loss.

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.

More by farismaulana

View all

28 more disclosed reports, best first.

More from Alchemix V3

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.