dispatchFrom() liveness DoS via StaleOracle : spot price manipulation blocks liquidations, force exercises, and premium settlements
The dispatchFrom function in PanopticPool unconditionally reverts with StaleOracle when the spot tick deviates from the TWAP by more than a threshold, blocking all liquidations, force exercises, and premium settlements. An attacker can front-run a liquidation with a swap to push the price out of range, causing the liquidation to revert and delaying it indefinitely.
Submitted by fuzious, also found by brotzumax, LinKenji, and Valves
PanopticPool.sol L1388-L1389
Finding description
The PanopticPool.dispatchFrom() function, which serves as the shared entrypoint for liquidations, force exercises, and long premium settlements, unconditionally reverts with Errors.StaleOracle() when the live spot tick (currentTick) deviates more than tickDeltaLiquidation ticks from the protocol’s internal TWAP (twapTick).
unchecked {
(RiskParameters riskParameters, ) = getRiskParameters(0);
int256 MAX_TWAP_DELTA_LIQUIDATION = int256(
uint256(riskParameters.tickDeltaLiquidation())
);
if (Math.abs(currentTick - twapTick) > MAX_TWAP_DELTA_LIQUIDATION)
revert Errors.StaleOracle();
}
The default threshold is MAX_TWAP_DELTA_LIQUIDATION = 513 ticks (defined in RiskEngine.sol L76), corresponding to approximately a 5.27% price deviation (1.0001^513 ≈ 1.0527).
This gate executes before the function determines whether the operation is:
- A liquidation (
solvent == 0) - A force exercise (
solvent == numberOfTicks && toLength == finalLength + 1) - A long premium settlement (
solvent == numberOfTicks && toLength == finalLength)
Consequently, when abs(currentTick - twapTick) > tickDeltaLiquidation, all dispatchFrom operations are blocked for all callers.
Impact
- Delayed/Blocked liquidations: Insolvent positions remain open longer than intended. In stressed markets, this increases the probability that losses socialize to PLPs (Panoptic Liquidity Providers) or manifest as bad debt.
- Blocked force exercises: Legitimate force exercise operations on exercisable long positions are prevented.
- Blocked premium settlements: Long premium settlement cannot occur, preventing sellers from collecting owed premium.
- Liquidator griefing: Liquidators can be griefed into repeated reverted transactions (gas loss) if they do not utilize private orderflow.
- Economic exploitation: An insolvent user (or MEV searcher acting on their behalf) can front-run detected liquidation transactions with a swap that pushes
currentTickbeyond the threshold, then optionally back-run to restore the price,repeatedly delaying liquidation indefinitely.
Attack scenarios
Scenario A: Mempool-reactive liquidation DoS
- Account becomes insolvent; a liquidator submits a liquidation via
dispatchFrom. - Account owner (or MEV searcher) observes the transaction in the public mempool.
- Attacker front-runs with a swap that pushes
currentTickbeyond ±tickDeltaLiquidationticks fromtwapTick. - Liquidation executes and reverts with
Errors.StaleOracle(). - Attacker can optionally back-run to restore price and minimize exposure.
- Repeat as needed to delay liquidation indefinitely.
Scenario B: Liveness failure during volatility
Even without a strategic attacker, large market moves can naturally place the spot price far from the protocol’s internal TWAP/EMA state. During that window, dispatchFrom is unavailable, coinciding with the exact periods where liquidations are most critically needed.
Recommended Mitigation Steps
The StaleOracle gate exists to prevent liquidation paths from executing at a potentially manipulated spot price. Removing it outright reintroduces price-manipulation attacks against liquidation pricing and accounting. Consider the following alternatives:
-
Two-step liquidation (Mark and Execute)
- Mark insolvency using TWAP/median-based criteria without reverting on divergence.
- Execute liquidation after a delay or once oracle state catches up.
-
Degraded mode: Proceed using oracle ticks only
- If
abs(currentTick - twapTick) > threshold, proceed but substitutecurrentTickwithtwapTick(ormedianTick/latestTick) for all liquidation/settlement pricing inputs.
- If
-
Rate-limited/Governance-guarded bypass
- Allow a privileged actor (or tightly scoped guardian role) to bypass the gate for emergency liquidation of specific accounts/pools.
Proof of Concept
PoC demonstrates end-to-end that:
- A valid liquidation succeeds when spot price is within the
tickDeltaLiquidationthreshold. - The same valid liquidation reverts with
Errors.StaleOraclewhen spot is moved out-of-range. - Force exercise and premium settlement are similarly blocked when out-of-range.
Test Coverage
Test | What it proves |
test_PoC_LiquidationExecutes_WhenInsolvent_AndPriceInRange | Valid liquidation executes when abs(currentTick - twapTick) <= tickDeltaLiquidation |
test_PoC_LiquidationDoS_BlocksValidLiquidation_WhenPriceOutOfRange | Same valid liquidation reverts with Errors.StaleOracle when spot is out-of-range |
test_PoC_ForceExerciseExecutes_WhenPriceInRange | Valid force exercise executes in-range (emits ForcedExercised) |
test_PoC_ForceExerciseDoS_BlocksValidForceExercise_WhenPriceOutOfRange | Force exercise blocked by Errors.StaleOracle when out-of-range |
test_PoC_PremiumSettlementExecutes_WhenPriceInRange | Premium settlement executes in-range (emits PremiumSettled) |
test_PoC_PremiumSettlementDoS_BlocksValidSettlement_WhenPriceOutOfRange | Settlement blocked by Errors.StaleOracle when out-of-range |
test_PoC_StaleOracleBoundary_StrictGreaterThan_WhenReachable | Gate is strict > (not >=) at exact boundary |
PoC Diff
To apply the PoC, create the file test/foundry/core/LiquidationDoSPoC.t.sol with the following content:
View detailed Proof of Concept
No more DoS via
StaleOraclefor liquidations.
Status: Mitigation confirmed. Full details in report from Nyx.
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
The StaleOracle check is applied before determining the operation type, so any price deviation beyond the threshold blocks all dispatchFrom operations for all callers.
Impact
Liquidations, force exercises, and premium settlements can be blocked, potentially leading to bad debt and socialized losses, and liquidators can be griefed with repeated failed transactions.
What the attacker needed
Insolvent position; public mempool access; ability to swap on the underlying pool
The fix
The issue was mitigated by removing the DoS via StaleOracle for liquidations, as confirmed in the mitigation review.
How it was found
- Account becomes insolvent and a liquidator submits a liquidation via dispatchFrom.
- Attacker observes the transaction in the public mempool.
- Attacker front-runs with a swap that pushes currentTick beyond the threshold from twapTick.
- Liquidation executes and reverts with Errors.StaleOracle().
- Attacker optionally back-runs to restore price and minimize exposure.
- Repeat as needed to delay liquidation indefinitely.
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 smart contract checks that the current market price is close to a long-term average before allowing certain actions like liquidating an unhealthy loan. If the price is too far off, it refuses to do anything. An attacker can briefly move the price just before a liquidation, causing it to fail, and then move it back, so the bad loan never gets closed.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.