# Missing liquidation eligibility condition

Does every debt cap, band, or borrow limit have a matching callable liquidation trigger?

_Area: DeFi oracles, liquidations and flash loans. Seen in 3 disclosed reports; latest 2024-02-22. Updated 2026-11-20._

## How it works
A protocol enforces a bound when a position opens (a minimum borrow size, a max debt per collateral token, a price band) but never wires that same bound into the path that lets others liquidate or exit. The assumption that "a position that violates a limit can be closed" breaks: the limit is checked only at open time, or the check is written with the wrong sign so it always passes. The position then sits in a state the protocol considers invalid but nobody can act on, and the loss lands on lenders or the protocol as bad debt.

## Where it shows up
- A `require`/`if` comparing a signed debt value against a positive deposit or minimum, where the left side can never be positive [E1](https://bugbountylibrary.com/r/sherlock%3A2023-03-notional%3AH-7.md).
- Open-time bounds (`maxBorrow`, `maxDebtPerCollateralToken`, min borrow size) with no matching condition in the liquidation/call function [E1](https://bugbountylibrary.com/r/sherlock%3A2023-03-notional%3AH-7.md)[E2](https://bugbountylibrary.com/r/c4%3A2023-12-ethereumcreditguild%3AM-07.md).
- Liquidation gated only on deadlines or deprecation flags, not on a health/limit check [E2](https://bugbountylibrary.com/r/c4%3A2023-12-ethereumcreditguild%3AM-07.md).
- A price-band or limit check present in `openPosition` but absent in `liquidate()` [E3](https://bugbountylibrary.com/r/sherlock%3A2024-02-perpetual%3AM-5.md).
- Interest accrual that can push a ratio past its cap after the open-time check passed [E2](https://bugbountylibrary.com/r/c4%3A2023-12-ethereumcreditguild%3AM-07.md).

## How to review
For each bound the protocol enforces, find the exact function that is supposed to close or liquidate a violating position and confirm the same bound appears there. The invariant: any state reachable by the protocol (including via interest accrual or quote drift) that violates a stated limit must be reachable by a callable liquidation or exit. Check sign conventions on every comparison: subtracting a positive deposit from a negative debt yields a more-negative number, so the inequality direction and the sign of each operand must be traced by hand [E1](https://bugbountylibrary.com/r/sherlock%3A2023-03-notional%3AH-7.md). Confirm the liquidation path re-checks the limit rather than trusting open-time state [E2](https://bugbountylibrary.com/r/c4%3A2023-12-ethereumcreditguild%3AM-07.md), and that every settlement path applies the same guard, not just the user-initiated one [E3](https://bugbountylibrary.com/r/sherlock%3A2024-02-perpetual%3AM-5.md).

## How finders spotted it
- Read the liquidation validation and traced the signs of `debtOutstanding` (negative) and `depositUnderlyingInternal` (positive), seeing the subtraction is always negative and the comparison trivially true [E1](https://bugbountylibrary.com/r/sherlock%3A2023-03-notional%3AH-7.md).
- Compared `_borrow`'s `maxBorrow` check against `_call`'s narrow liquidation conditions, noticing `partialRepay` only enforces a minimum percent so interest can breach the cap without triggering callability [E2](https://bugbountylibrary.com/r/c4%3A2023-12-ethereumcreditguild%3AM-07.md).
- Noticed `_checkPriceBand` applied in `_openPosition` but absent in `liquidate()`, then reasoned the maker's quote widens with one-sided flow and can exit the band while the oracle midpoint stays inside [E3](https://bugbountylibrary.com/r/sherlock%3A2024-02-perpetual%3AM-5.md).

## Variants seen
- Sign/logic error making a minimum-borrow check always pass, allowing partial liquidation that leaves dust debt [E1](https://bugbountylibrary.com/r/sherlock%3A2023-03-notional%3AH-7.md).
- Bound enforced at open but violable later by interest accrual, with no liquidation trigger [E2](https://bugbountylibrary.com/r/c4%3A2023-12-ethereumcreditguild%3AM-07.md).
- Guard applied to voluntary orders but not to liquidation, blocking exits when the quote drifts [E3](https://bugbountylibrary.com/r/sherlock%3A2024-02-perpetual%3AM-5.md).

## Impact and severity
Unliquidatable positions become bad debt borne by lenders or the protocol [E1](https://bugbountylibrary.com/r/sherlock%3A2023-03-notional%3AH-7.md)[E2](https://bugbountylibrary.com/r/c4%3A2023-12-ethereumcreditguild%3AM-07.md); blocked voluntary exits force unavoidable liquidations [E3](https://bugbountylibrary.com/r/sherlock%3A2024-02-perpetual%3AM-5.md). Severity rises when the violating state is reachable without attacker action (interest accrual) and when offboarding the whole term force-closes all positions, concentrating losses [E2](https://bugbountylibrary.com/r/c4%3A2023-12-ethereumcreditguild%3AM-07.md).

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2023-03-notional%3AH-7.md
- E2: https://bugbountylibrary.com/r/c4%3A2023-12-ethereumcreditguild%3AM-07.md
- E3: https://bugbountylibrary.com/r/sherlock%3A2024-02-perpetual%3AM-5.md
