58474 sc high liquidator will bypass liquidation fees affecting protocol revenue
Submitted on Nov 2nd 2025 at 14:58:43 UTC by @resosiloris for Audit Comp | Alchemix V3
Report ID: #58474
Report Type: Smart Contract
Report severity: High
Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/AlchemistV3.sol
Impacts:
Theft of unclaimed yield
Description
Brief/Intro
The missing fee calculation when debt exceeds collateral in AlchemistV3.sol::calculateLiquidation() will cause a complete loss of liquidation fee revenue for the protocol as liquidators will receive 100% of collateral without paying the expected 5% liquidation fee when positions reach critical undercollateralization.
Vulnerability Details
Root Cause
In AlchemistV3.sol:1252-1255, the calculateLiquidation() function returns a fee of 0 when debt >= collateral, allowing liquidators to claim the entire collateral amount without paying any liquidation fees:
function calculateLiquidation(
uint256 collateral,
uint256 debt,
uint256 targetCollateralization,
uint256 alchemistCurrentCollateralization,
uint256 alchemistMinimumCollateralization,
uint256 feeBps
) public pure returns (uint256 grossCollateralToSeize, uint256 debtToBurn, uint256 fee, uint256 outsourcedFee) {
if (debt >= collateral) {
outsourcedFee = (debt * feeBps) / BPS;
// fully liquidate debt if debt is greater than collateral
return (collateral, debt, 0, outsourcedFee); // ❌ fee = 0
}
// ... rest of function
}The vulnerability exists because when a position becomes severely undercollateralized (debt ≥ collateral), the function immediately returns with fee = 0, bypassing the normal fee calculation logic that would charge the liquidator a percentage of the seized collateral.
Internal Pre-conditions
A user position needs to exist with deposited collateral and minted debt
The position's collateralization ratio needs to drop below the liquidation threshold (
collateralizationLowerBound= 150%)Market conditions or yield token price depreciation needs to cause the position's collateral value to fall to or below the debt value (debt ≥ collateral)
External Pre-conditions
Yield token (MYT) price needs to decrease significantly relative to the underlying token, causing collateral value to drop
Market volatility needs to create conditions where positions can reach critical undercollateralization (debt ≥ collateral value)
Attack Path
Position Creation: A user deposits 1000 yield tokens as collateral and mints 500 debt tokens (50% LTV, within the 200% minimum collateralization requirement)
Market Deterioration: The yield token's conversion rate drops from 100% to 49% due to market conditions, oracle price changes, or yield token depegging
Critical Undercollateralization: The position's collateral value drops to ~490 debt tokens worth, making
debt (500) >= collateral (490)Fee Bypass Exploitation: A liquidator calls
liquidate()on the position:calculateLiquidation()detectsdebt >= collateralReturns
fee = 0instead of calculating the proper liquidation feeLiquidator receives 100% of the remaining collateral (490 tokens worth)
Protocol receives 0 liquidation fee revenue
Revenue Loss: The protocol loses the expected 5% liquidation fee (~24.5 tokens worth) that should have been charged on the seized collateral
Impact Details
The protocol suffers a complete loss of liquidation fee revenue in critical undercollateralization scenarios. Given that:
Liquidation fees are set at 5% (
liquidatorFee = 500 bps)These scenarios are most likely during market stress when liquidations are frequent
The protocol relies on liquidation fees as a revenue stream
Quantified Impact:
For every 1000 tokens of collateral liquidated in debt ≥ collateral scenarios, the protocol loses 50 tokens in expected fees
During market crashes when this condition is most common, the revenue loss compounds across multiple liquidations
This directly reduces protocol sustainability and fee distribution to stakeholders
References
Add any relevant links to documentation or code
Proof of Concept
Proof of Concept
The following test demonstrates the complete fee bypass when debt exceeds collateral.
Main POC Test File
File: test/poc/ACC_POC-AlchemistV3-LiquidationFeeBypass.t.sol
Required Mock Files
File: test/mock/MockAlchemicTokenLimited.sol
File: test/mock/MockTransmuter.sol
File: test/mock/MockMorphoYieldToken.sol
File: test/mock/MockUnderlyingToken.sol
File: test/mock/MockFeeVault.sol
Test Execution
Command:
Expected Output:
Was this helpful?