58269 sc high liquidator fee not paid when fee equals surplus
Submitted on Oct 31st 2025 at 21:05:23 UTC by @xanony for Audit Comp | Alchemix V3
Report ID: #58269
Report Type: Smart Contract
Report severity: High
Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/AlchemistV3.sol
Impacts:
Smart contract unable to operate due to lack of token funds
Description
Brief/Intro
When liquidating an undercollateralized position in AlchemistV3, the protocol calculates a base liquidator fee as a percentage of the position's surplus (collateral - debt). However, due to an incorrect execution order in the fee payout logic, liquidators receive zero tokens when the calculated fee equals or exceeds the remaining collateral balance after seizure.
This vulnerability breaks the economic incentive mechanism for liquidations, potentially causing:
Delayed or missed liquidations during market stress
Accumulation of bad debt in the protocol
Loss of liquidator confidence in the system
Vulnerability Details
Vulnerability Details
Affected Component
Contract:
src/AlchemistV3.solFunction:
_doLiquidation()(lines 852-900)Vulnerable Code: Line 878
Root Cause
The bug occurs due to incorrect sequencing in _doLiquidation():
The Problem:
amountLiquidated = debtToBurn + fee(gross seizure amount)Line 870: Account balance reduced by full
amountLiquidatedLine 878: Check
account.collateralBalance >= feeInYieldfails because balance was already depletedResult: Liquidator receives 0 tokens despite protocol calculating a non-zero fee
Impact Details
Direct Impact
Broken Incentives: Liquidators receive zero compensation despite protocol promises
Delayed Liquidations: Unprofitable liquidations ignored, allowing bad debt accumulation
System Instability: Lack of timely liquidations during market volatility can threaten solvency
Funds at Risk
Per-liquidation impact:
Typical scenario: Position with $100k collateral, $95k debt → $5k surplus
At 1% fee: $50 lost per liquidation
At 5% fee: $250 lost per liquidation
At 100% fee: $5,000 lost per liquidation
Systemic risk: If liquidations are delayed due to broken incentives, bad debt could accumulate to millions during volatile markets.
References
Vulnerable contract:
https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/AlchemistV3.sol#L1-L1327Bug location: Line 878 (
_doLiquidation)Fee calculation: Lines 1244-1288 (
calculateLiquidation)
Link to Proof of Concept
https://gist.github.com/leojay-net/8d034edf48bb186ad76e3159dff42eb5
Proof of Concept
Proof of Concept
Was this helpful?