Dust cleanup burns more debt than callers account for
The debt token's burn function can turn a partial repayment into a full debt wipe when the remaining scaled debt is one or less, but the router still assumes only the requested amount was burned. A borrower can repay a small amount and have more debt cancelled than they paid, and the router's borrow flag and deficit accounting become inconsistent.
Submitted by v12, also found by niffylord
Found by V12
contracts/debt-token/src/contract.rs#L205contracts/kinetic-router/src/storage.rs#L256contracts/kinetic-router/src/operations.rs#L450
Targets
- DebtTokenContract::burn_scaled
- KineticRouter::execute_repay
- KineticRouterContract::addreservedeficit
- KineticRouter::repay
Affected Locations
- DebtTokenContract.burn_scaled:
burn_scaledrounds the requested amount into scaled units and, whennew_scaled_debt <= 1, promotes a partial burn into a full debt wipe instead of preserving the caller’s requested burn size. - KineticRouter.execute_repay:
execute_repayignores theburn_scaledreturn value and derivesremaining_debtfromdebt_balance - amount_to_repay, which leaves router state inconsistent when dust cleanup zeroes the position early. - KineticRouterContract.addreservedeficit:
add_reserve_deficitpersists the stale caller-supplied amount instead of the actual debt written off, so liquidation bad-debt accounting can under-record losses when dust cleanup increases the effective burn. - KineticRouter.repay:
repayis the external entrypoint that transfers only the caller-requested underlying amount, then relies on pre-burn arithmetic for debt cleanup even when the debt token may have burned more debt than requested.
Description
The protocol lets DebtTokenContract::burn_scaled change the economic result of a partial burn through its dust-cleanup branch, but surrounding router logic still assumes the caller-requested amount is the amount of debt actually removed. In the repay flow, this means the router transfers only amount_to_repay underlying and then can have burn_scaled extinguish the borrower’s final scaled unit anyway, forgiving debt that was never paid. The same mismatch also corrupts state cleanup, because borrow-bit clearing is derived from pre-burn remaining_debt instead of the debt token’s actual outcome, leaving is_borrowing set after debt is already zero. The issue is repeated in bad-debt handling, where liquidation paths compute a deficit amount before calling burn_scaled and add_reserve_deficit records that stale value even if dust cleanup wrote off more debt. These behaviors all stem from the same semantic gap between what burn_scaled is allowed to do and what its callers account for.
Root Cause
DebtTokenContract::burn_scaled may increase a partial burn into a full dust cleanup, but KineticRouter uses requested and pre-burn amounts as the source of truth instead of reconciling transfers, borrow-flag updates, and deficit accounting to the actual burn result.
Impact
A borrower can repay just enough to trigger dust cleanup and have more debt canceled than the underlying they supplied, leaking reserve value over repeated cycles. The same desynchronization can also strand users with phantom borrow positions that consume one of the MAX_USER_RESERVES = 15 slots, and it can understate reserve deficits so later protocol-reserve collection treats part of a real shortfall as withdrawable funds.
Proof of Concept
See this gist for full Proof of Concept
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 debt token's burn function can increase a partial burn into a full wipe, but the router uses the caller-requested amount and pre-burn balances instead of the actual burn result.
Impact
A borrower could repay less than the debt cancelled, leaking reserve value over repeated cycles, and the same mismatch can leave phantom borrow positions and understate reserve deficits.
What the attacker needed
A borrower with a small remaining debt; ability to call repay
The fix
The router should reconcile transfers, borrow-flag updates, and deficit accounting to the actual burn result returned by the debt token, rather than relying on requested or pre-burn amounts.
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 repays a tiny amount of debt, but the system's debt token decides to wipe out the whole remaining debt because it is very small. The router, which handles the repayment, still thinks only the tiny amount was paid, so it records the wrong debt balance and may leave the borrower marked as still borrowing even though the debt is gone.
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.