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.
Originally disclosed on Immunefi
- 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
- Report ID: #56336
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi\\_audit/src/strategies/optimism/StargateEthPoolStrategy.sol
- Impacts:
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
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
Proof of Concept
Proof of Concept
- contract deallocating 100 LP amount
- currently the contract is having 99.8 LP amount
- cap the amount, and call
pool.redeemusing 99.8 LP, and get 99.8 ether - check if the
ethRedeemed < amountwhich is99.8 < 100 - emit the deallocation loss event, even though that is all LP token the contract have and no deallocation loss happen
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
- The contract is asked to deallocate 100 LP.
- The contract only holds 99.8 LP.
- The amount is capped and the redeem call uses 99.8 LP, returning 99.8 ether.
- The code checks whether the redeemed ETH is less than the original amount.
- 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.