Liquidation uses DexV2 spot price to derive D3 collateral composition and weighted penalties, enabling MEV over-seizure
Liquidation of D3 concentrated-liquidity collateral reads the DexV2 pool spot price to split the position into token amounts and to weight the liquidation penalty, so a liquidator can sandwich the pool to skew the composition and seize more collateral value than at an unmanipulated price. The same spot-tick dependency lets swap fees paid during the manipulation be counted as accrued to the victim position and seized in the same liquidation.
Source: https://github.com/sherlock-audit/2026-01-fluid-dex-v2-judging/issues/1114
Found by
0x37, 6PottedL, AV, Baazigar, Bizarro, Kalyan__tr, Laksmana, Rizalfahmi, Silvermist, Slayer, ZeroTrust, hexnikk, pashap9990, thimthor, velev, xiaoming90, yonko
Summary
The reliance on DexV2 pool spot state (sqrtPriceX96/currentTick) when computing D3/D4 liquidation withdrawals will cause excessive collateral seizure for liquidated borrowers as MEV liquidators will sandwich the pool price around liquidate() to skew LP composition, accrued fees, and the value-weighted liquidation penalty in their favor.
Root Cause
- In
protocols/moneyMarket/core/liquidateModule/main.sol:369-423the liquidation path forD3_POSITION_TYPEderivestoken0SupplyAmount/token1SupplyAmountusingsqrtPriceX96: AT_POOL_PRICE, then computesaverageLiquidationPenalty_from those spot-derived amounts and scaleswithdrawValueby that average penalty. - In
protocols/moneyMarket/core/other/helpers.sol:467-470_getD3SupplyAmountstreatsAT_POOL_PRICEas a sentinel and reads the current poolsqrtPriceX96directly from DexV2 packed variables, making liquidation-time collateral decomposition depend on manipulable spot price. - In
protocols/moneyMarket/core/other/helpers.sol:418-439_getDexV2FeeAccruedAmountsuses the current pool tick from DexV2 variables to compute fee growth “inside” the range; liquidation consumes these spot-tick-dependent accrued fees in both:- D3 liquidation fee handling (
protocols/moneyMarket/core/liquidateModule/main.sol:383-385andmain.sol:481-501), and - D4 liquidation fee withdrawal (
protocols/moneyMarket/core/liquidateModule/main.sol:563-579).
- D3 liquidation fee handling (
Internal Pre-conditions
External Pre-conditions
Attack Path
D3 collateral positions represent concentrated-liquidity (CL) liquidity in a DexV2 pool over a tick range. For CL positions, the instantaneous split of the position between token0 and token1 is a function of the current pool price: pushing price toward one end of the range makes the position hold almost entirely one token, while pushing price toward the other end makes it hold mostly the other token.
In the D3 liquidation withdraw branch, the protocol intentionally passes sqrtPriceX96: AT_POOL_PRICE into _getD3SupplyAmounts, which forces the helper to read the current pool sqrtPriceX96 from DexV2 storage. Those spot-derived amounts are then valued with oracle prices and used to compute averageLiquidationPenalty_ as a value-weighted average of the two token liquidation penalties. Finally, withdrawValue (the amount of collateral value to seize for a given payback value) is scaled up by averageLiquidationPenalty_.
This creates a liquidation-time dependency on a permissionless, manipulable input: any MEV actor can move the DexV2 pool price/tick via swaps in the same block and then call liquidate(). By doing so, the liquidator can:
- Change the D3 position’s liquidation-time token composition (token0 vs token1 amounts).
- Change the value-weighted liquidation penalty (since the weights depend on the manipulated composition, and token penalties can differ).
- Change which token(s) are actually withdrawn (because the withdrawal amounts are computed from the spot-derived token amounts and
withdrawValue).
Additionally, liquidation reads and withdraws D3/D4 fees based on spot tick via _getDexV2FeeAccruedAmounts. If the liquidator’s pre-liquidation swap activity generates fees while the victim position is in-range, those newly accrued fees can be immediately accounted for and (depending on how much of withdrawValue remains after principal withdrawal, or in the D4 fee-withdraw branch) seized as part of the liquidation withdrawal. This “fee recycling” reduces the effective cost of manipulating the pool state and amplifies the profitability and reliability of the sandwich.
Critically, the protocol’s liquidation eligibility is gated by health factor calculations that use an oracle-implied sqrt price for D3/D4 valuation, not the pool spot price (see _getHfInfo using _calculateSqrtPriceX96 and passing that into _getD3SupplyAmounts/_getD4DebtAmounts in protocols/moneyMarket/core/other/helpers.sol:899-920 and helpers.sol:974-997). As a result, a liquidator can manipulate pool spot price aggressively without needing to manipulate the oracle-based HF check, making this a clean MEV surface focused on liquidation extraction rather than liquidation eligibility.
Attack Path
Attack path 1 — Inflate the value-weighted D3 liquidation penalty by skewing spot composition
- MEV liquidator monitors for a liquidatable NFT whose chosen withdraw position is
D3_POSITION_TYPE, and where the effective per-token liquidation penalties differ. - Liquidator front-runs with a swap in the relevant DexV2 pool to move
sqrtPriceX96/currentTicktoward the end of the victim’s tick range that makes the D3 position hold mostly the higher-penalty token at that instant. - Liquidator calls
FluidMoneyMarketLiquidateModule.liquidate()selecting that D3 position aswithdrawPositionIndex. - The module calls
_getD3SupplyAmounts(... sqrtPriceX96: AT_POOL_PRICE)(liquidateModule/main.sol:369-381), which reads the manipulated pool spot price (other/helpers.sol:467-470) and returns a skewedtoken0SupplyAmount/token1SupplyAmount. - The module computes
averageLiquidationPenalty_using oracle-valued weights derived from the manipulated composition and scaleswithdrawValueupward (liquidateModule/main.sol:408-423). - The liquidation withdraws a larger amount of collateral value (and/or a more favorable token composition) than would be possible at an unmanipulated pool price, transferring additional value from borrower to liquidator.
- Liquidator back-runs with the inverse swap to restore pool price and realizes net MEV profit (or uses the seized collateral to unwind the initial manipulation).
Attack path 2 — Token mix steering to maximize realized liquidation profit even without large penalty differences
- Liquidator chooses a swap direction that makes the D3 position’s liquidation-time composition concentrate into the token the liquidator prefers to receive (e.g., more liquid to unwind, less volatile to hold, or easier to source/hedge).
- Liquidator calls
liquidate()while the pool remains in the manipulated state. - Because withdrawal amounts are computed from the spot-derived token amounts, the liquidation withdraws collateral predominantly in that preferred token.
- Liquidator reduces external swap/slippage costs required to realize profit from the seized collateral, increasing effective extraction versus liquidation at the unmanipulated spot.
Attack path 3 — Fee-recycling sandwich using spot-tick-dependent fee accrual (D3 and D4)
- Liquidator performs a pre-liquidation swap (or a sequence of swaps) that moves price/tick and pays swap fees to in-range liquidity that includes the victim’s D3/D4 position.
other/helpers.sol:_getDexV2FeeAccruedAmountscomputes fees “inside” the victim range using the current tick (helpers.sol:418-439), so the just-paid fees become immediately attributable asfeeAccruedToken0/feeAccruedToken1.- Liquidator immediately calls
liquidate():- For D3 withdraw, accrued fees are added to stored fees (
liquidateModule/main.sol:383-385) and can be seized if liquidation proceeds to fee withdrawal (main.sol:481-501). - For D4 withdraw, accrued fees are added to stored fees (
main.sol:563-579) and then withdrawn via_useFeeStoredForLiquidation(main.sol:581-613).
- For D3 withdraw, accrued fees are added to stored fees (
- Liquidator recovers part of the manipulation costs via seized victim fees, increasing net profitability and worsening borrower outcome.
Impact
The liquidated borrowers suffer an approximate loss of up to the configured maxLiquidationPenalty portion of the repaid debt value per liquidation in excess collateral seized relative to liquidation at an unmanipulated pool price. The liquidator gains this additional seized collateral value (net of swap fees/slippage required to manipulate and unwind the pool price), and can further amplify extraction by recycling swap-generated fees that accrue to the victim position and are then seized during the same liquidation transaction.
Add the following subsection under your existing ## Impact section (right after the current impact paragraph). It keeps all existing content intact and demonstrates a concrete path to exceeding $10 loss.
Loss threshold demonstration
In liquidateModule/main.sol, liquidation starts with v_.withdrawValue = v_.paybackValue (main.sol:245) and then scales withdrawValue up by the (spot-derived) liquidation penalty factor (main.sol:421):
withdrawValue ≈ paybackValue * (1000 + averageLiquidationPenalty) / 1000
Therefore, if MEV manipulation changes the computed averageLiquidationPenalty by Δp (where penalties use THREE_DECIMALS = 1000 precision), the incremental over-seizure relative to an unmanipulated pool state is:
extraSeized ≈ paybackValue * Δp / 1000
Concrete example (showing extraSeized > $10 from penalty skew alone):
- Assume the effective liquidation penalties used by the liquidation logic differ across the two tokens, e.g.:
- token0 liquidation penalty = 50 (5%)
- token1 liquidation penalty = 150 (15%)
- Without manipulation, suppose the D3 position is roughly balanced by value at the current pool price, so:
averageLiquidationPenalty ≈ (50 + 150) / 2 = 100(10%)
- With manipulation, the liquidator pushes the pool price toward the end of the range where the position is mostly the higher-penalty token (token1), so:
averageLiquidationPenalty ≈ 150(15%)
- This yields
Δp ≈ 50(5%).
If the liquidation repays only paybackValue = $250 of debt, the incremental collateral seized due to the manipulated penalty becomes:
extraSeized ≈ 250 * 50 / 1000 = $12.5
This exceeds the $10 threshold in a single liquidation. Even if the penalty skew is smaller (e.g., Δp = 10 = 1%), any liquidation with paybackValue ≥ $1,000 yields extraSeized ≥ $10.
PoC
No response
Mitigation
No response
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 liquidation path uses the manipulable DexV2 pool spot price and tick (via the AT_POOL_PRICE sentinel and spot-tick fee accrual) to derive collateral composition, penalty weighting and accrued fees, instead of a manipulation-resistant price.
Impact
Liquidated borrowers could lose up to the configured maximum liquidation penalty portion of repaid debt value in extra seized collateral, and the liquidator could recover part of the manipulation cost through fees accrued to the victim position; the text does not state that any defence blocked this.
What the attacker needed
A liquidatable D3 position; per-token penalties differ; ability to swap in the DexV2 pool
The fix
Liquidation should derive D3 collateral composition, penalty weighting and accrued fees from a manipulation-resistant price rather than the DexV2 pool spot price and tick.
How it was found
- Watch for a liquidatable position whose withdraw position is D3 and whose per-token penalties differ.
- Swap in the DexV2 pool to push the spot price toward the end of the victim's tick range holding the higher-penalty token.
- Call liquidate() selecting that D3 position as the withdraw position.
- The module reads the manipulated spot price and returns a skewed token split.
- The penalty is recomputed from the skewed split and the withdraw value is scaled up.
- Swap back to restore the price and realise the extra seized collateral.
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 borrower's collateral here is a share of a trading pool whose split between two tokens changes with the pool's current price. The liquidation code reads that live price instead of a stable reference, so someone can trade to shift the price just before liquidating, making the collateral look like it is mostly the token with the bigger penalty. The liquidator then takes more of the borrower's collateral than a fair liquidation would.
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.