Skip to content
Business logic Audit finding Intermediate

Single-asset cap check wrongfully forgives all remaining debt

The liquidation function treats exhaustion of one selected collateral asset as exhaustion of the entire collateral portfolio, clearing the user's remaining debt as bad debt. An attacker can liquidate a dust-sized secondary collateral to trigger this, causing the protocol to forgive debt still backed by other assets.

v12 Follow with 0xanmol, 0xApple and 43 others

Originally disclosed on Code4rena

Submitted by v12, also found by 0xanmol, 0xApple, 0xastronatey, 0xfallin1, AD404, Agontuk, AlexeyMilovanov, AvantGard, biakia, Bizarro, Brene, coinsspor, D_Auditor, DemoreX, dqt2506, Drothon, Emmy, Eniwealth, futurehelp, fuzious, harry, hezze, ht111111, Ibukun, j0bear, jaredkusnev, jerryoung, Khan2018, kimnoic, KineticsOfWeb3, Lamsy, legat, LightManKnows, maxzuvex, mishoko, nashhacks43, qed, quietledger, Ronke, samuraii77, snap, spectator, twicek, unsullied, and wuji

Found by V12

  • contracts/kinetic-router/src/liquidation.rs #L124

Targets

  • KineticRouter::internalliquidationcall

Affected Locations

  • KineticRouter.internalliquidationcall: When collateral_amount_to_transfer > user_collateral_balance for the selected collateral_asset, the function treats that single-asset exhaustion as if all user collateral has been exhausted and then clears the remaining debt as bad debt.

Description

The liquidation flow conflates exhaustion of one chosen collateral asset with exhaustion of the user’s entire collateral portfolio. In internal_liquidation_call, if collateral_amount_to_transfer > user_collateral_balance for the liquidated collateral_asset, collateral_cap_triggered is set and the code proceeds to burn the user’s remaining debt and socialize it as protocol bad debt. That assumption is invalid in a multi-collateral account, because the borrower may still hold substantial balances in other collateral assets. A liquidator can therefore target a dust-sized secondary collateral balance, intentionally trigger the cap condition, and cause the protocol to forgive debt that is still fully backed by other assets. The user can then keep or later withdraw their primary collateral while their debt has already been erased from the system.

Root Cause

collateral_cap_triggered is derived only from the balance of the selected collateral_asset, but the function incorrectly uses it as a global signal that all collateral is exhausted and the user’s remaining debt should be forgiven.

Impact

An attacker can shed a large borrowed position by liquidating only a dust collateral asset, leaving the protocol to absorb the rest as deficit. This creates a direct loss of protocol value because the forgiven debt is not actually unrecoverable and the user’s other collateral remains intact and withdrawable.

Proof of Concept

Please review this gist for PoC


The original report as published on Code4rena, by v12. 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 code uses a per-asset balance check as a global signal that all collateral is exhausted, without verifying other collateral assets.

Impact

An attacker can shed a large borrowed position by liquidating only a dust collateral asset, leaving the protocol to absorb the rest as deficit.

What the attacker needed

Multi-collateral account; dust-sized secondary collateral; liquidator role

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.

In a lending system, a borrower puts up several types of assets as security for a loan. When one of those assets runs out during a forced sale (liquidation), the code mistakenly assumes the borrower has no other security left and cancels the rest of the loan. This lets a borrower keep valuable security while their debt disappears, leaving the lending platform to absorb the loss.

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 v12

View all

37 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.