Skip to content
Business logic Audit finding Advanced

Same-Asset Borrow Positions Can Become Insolvent With No Working Liquidation Path

The borrow path lets a user open a position where the collateral and the borrowed asset are the same reserve, but the liquidation paths cannot resolve such a position once it becomes unhealthy. Over time the growing debt index can push the position into bad debt that ordinary liquidators cannot clear.

ChainSentry Follow with 0x04, 0xApple and 48 others

Originally disclosed on Code4rena

Submitted by ChainSentry, also found by 0x04, 0xApple, 0xBeastBoy, 0xbyteninja, 0xc0ffEE, 0xCiphky, 0xterrah, ABAIKUNANBAEV, abdelhaq16, Agontuk, AvantGard, bchen, Bigsam, blackpanther, botdidy, CircuitBreaker, cnwangjihe, coinsspor, defi_cit, DemoreX, edoscoba, Ekomzy, Eniwealth, Fade_cyrpto, faldiox, fromeo_016, fuzious, fxch, gh0xt, gwumex, happykilling, harry, hezze, insecuremary, Jesse, Joseph_Nwodoh, Kafoo, kematens, KeyZora, khaye26, Kingdavid, Kryptos, lanrebayode77, legat, lostOpcode, lufP, maigadoh, maxzuvex, mounbasit, n0fr33w1f14u, osuolale, pepoc, poppy, rajatbeladiya, Rexx, samuraii77, Silvermist, SOPROBRO, t4sk, Tewogbade, TheodorNEngoy, TheSchnilch, TheWeb3Mechanic, tradingview, trapAkula, tubadeligoz, twicek, udogodwin, unsullied, XDZIBECX, and yaskow92i

  • contracts/kinetic-router/src/operations.rs #L285-L330
  • contracts/kinetic-router/src/validation.rs #L517-L534
  • contracts/kinetic-router/src/router.rs #L519-L681
  • contracts/kinetic-router/src/router.rs #L734-L804
  • contracts/kinetic-router/src/flash_loan.rs #L387-L516

The protocol allows a user to create a position where the collateral asset and the borrowed asset are the same reserve. That position starts healthy, but over time the debt index grows faster than the liquidity index, so the debt can overtake the collateral even if the market price never changes.

When that happens, the protocol has no working incentive-compatible liquidation path:

  • direct liquidation rejects collateral_asset == debt_asset
  • prepared liquidation still authorizes the same-asset pair
  • execution of that prepared liquidation fails with FlashLoanNotRepaid even when the swap handler returns a perfect 1:1 same-token output

This produces unliquidatable bad debt through normal public entrypoints.

Why the Documentation Matters

The liquidation documentation explicitly says that collateral and debt assets must differ, and explains that same-asset liquidation is invalid because it would let a borrower repay debt with the same collateral being seized.

That statement matters because it establishes a protocol invariant: if liquidation is intentionally designed to reject same-asset pairs, then the borrow path must either:

  1. reject same-asset positions up front, or
  2. provide some other supported resolution path for them

The contracts do neither. The borrow path allows the position to be created, but the liquidation paths do not reliably resolve it once it becomes unhealthy.

Documentation reference:

  • 06-LIQUIDATION.md:1038-1048

Code References

  • Borrow path allows the position to be created:

    • contracts/kinetic-router/src/operations.rs:285-330
  • Direct liquidation rejects same-asset pairs:

    • contracts/kinetic-router/src/validation.rs:517-534
  • Prepared liquidation checks health factor and reserve state, but never enforces collateral_asset != debt_asset before storing authorization:

    • contracts/kinetic-router/src/router.rs:510-681
  • Execute path consumes the stored authorization and proceeds into flash-loan settlement for the same-asset pair:

    • contracts/kinetic-router/src/router.rs:734-982
  • Flash-liquidation callback burns same-reserve collateral, then transfers back only debt_to_cover, which is insufficient when collateral_to_seize > debt_to_cover:

    • contracts/kinetic-router/src/flash_loan.rs:387-557

Root Cause

The protocol relies on a same-asset prohibition during liquidation, but it does not preserve that invariant during borrow.

The failure is a cross-path mismatch:

  1. borrow validates reserve state, caps, and health factor, but it never rejects borrowing the same reserve that is being used as collateral.
  2. Direct liquidation explicitly rejects same-asset pairs as InvalidLiquidation.
  3. prepare_liquidation does not apply that rejection and stores an authorization for the same-asset pair.
  4. execute_liquidation uses a flash loan from the debt reserve’s aToken and then, inside the callback, burns the borrower’s collateral out of that same reserve before transferring only debt_to_cover back to the aToken.

In the reproduced PoC, the prepared authorization contained:

  • debt_to_cover = 1_000_000_000
  • collateral_to_seize = 1_050_000_000

Because the collateral and debt asset are the same, the reserve loses 1.05 units of underlying for every 1.00 unit returned. That is exactly why the flash-loan repayment check fails even with a perfect 1:1 same-token swap handler.

Impact

Any user can open a same-asset collateral/debt position through the public borrow entrypoint. That position can become unhealthy and then insolvent over time without any oracle manipulation or admin action.

Once insolvent, ordinary liquidators cannot resolve it:

  • direct liquidation is hard-rejected
  • prepared liquidation is accepted and then fails at execution

That means the protocol’s normal liquidation mechanism cannot clear the debt. At that point, only an uncompensated third-party repayment or some out-of-band intervention can reduce the position. That is not a functioning liquidation path.

This is therefore a protocol liveness and solvency issue, not a cosmetic validation mismatch or a mere gas-griefing edge case.

Recommendation

The most robust fix is to reject same-asset debt positions at creation time.

Minimum fix set:

  1. In borrow, reject opening debt against the same reserve that is enabled as collateral for that user.

  2. In prepare_liquidation and execute_liquidation, enforce the same collateral_asset != debt_asset invariant used by direct liquidation.

  3. Add regression coverage proving that:

    • same-asset borrow is rejected, or
    • if recursive same-asset leverage is intentionally supported, it has a dedicated insolvency-resolution path that does not rely on a same-reserve flash loan.

Severity Rationale

  • It is reachable through normal public entrypoints
  • It can deterministically create insolvent positions over time
  • Once those positions cross into bad debt, the protocol’s intended liquidation flows do not work

The core impact is that the protocol can accumulate bad debt that its own liquidation system cannot clear through the documented permissionless liquidation path.

Proof of Concept

See original finding for full Proof of Concept

Why this is defensibly different from other unliquidatable-debt findings

This issue does not rely on oracle rotation, stale price caches, bitmap inflation, or zero-balance collateral toggles.

Its root cause is different:

  • same-asset debt positions are allowed to be created
  • the liquidation system is explicitly designed to reject same-asset settlement
  • the prepared liquidation path inconsistently authorizes the pair and then fails during same-reserve flash-loan settlement

The original report as published on Code4rena, by ChainSentry. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 borrow path never enforced the same-asset prohibition that the liquidation paths assume, so a same-reserve position can be created but not liquidated.

Impact

Same-asset positions can become insolvent over time and cannot be cleared through the documented permissionless liquidation path, leaving bad debt that only an uncompensated third-party repayment or out-of-band intervention could reduce.

What the attacker needed

Public borrow entrypoint access; time for debt index to outgrow collateral

The fix

The borrow path should reject same-asset debt positions at creation, and the prepared and execute liquidation paths should enforce the same collateral-asset-differs-from-debt-asset check used by direct liquidation.

How it was found

  1. Open a borrow position using the same reserve as both collateral and debt.
  2. Let the debt index grow faster than the liquidity index until the position becomes unhealthy.
  3. Attempt direct liquidation, which is rejected for same-asset pairs.
  4. Attempt prepared liquidation, which stores the authorization but fails at execution with a flash-loan repayment error.

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 lending protocol lets people deposit one token as security and borrow another. Here the same token could be both the security and the loan, and the rules for taking over an unhealthy position (liquidation) were written assuming the two tokens are always different. So when the loan grew larger than the security, nobody could step in and close it, leaving the protocol with a debt it cannot recover.

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.

More by ChainSentry

View all

3 more disclosed reports, best first.

More from K2

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.