Skip to content
Business logic Audit finding Advanced

Stale collateral indices understate health factor

The router values collateral using a stored liquidity index that may be stale, while debt is accrued to the current time, so the two sides of an account are measured at different timestamps. This understates the health factor, which could let healthy positions be liquidated prematurely or block withdrawals, borrowing and swaps.

v12 Follow with 0xApple, 0xc0ffEE and 19 others

Originally disclosed on Code4rena

Submitted by v12, also found by 0xApple, 0xc0ffEE, Augusta, Bizarro, D_Auditor, DemoreX, Es, hezze, JohnTears, kb520, KineticsOfWeb3, oxwhite, qed, Regem21, samuraii77, snufflesrea, TheSchnilch, twicek, wuji, xiaoye, and Xmannuel

Found by V12

  • contracts/kinetic-router/src/calculation.rs #L99
  • contracts/kinetic-router/src/calculation.rs #L549
  • contracts/kinetic-router/src/calculation.rs #L585

Targets

  • KineticRouter::calculateuseraccountdataunified
  • KineticRouter::calculateuseraccount_data
  • KineticRouter::validateswaphealth_factor

Affected Locations

  • KineticRouter.calculateuseraccountdataunified: Core solvency logic values collateral with stored reserve_data.liquidity_index instead of a time-accrued current liquidity index, while debt is accrued with get_current_variable_borrow_index_with_data.
  • KineticRouter.calculateuseraccount_data: Wrapper entrypoint forwards account checks into the unified implementation, so callers inherit collateral undervaluation when reserve liquidity indices in storage are stale.
  • KineticRouter.validateswaphealth_factor: Swap solvency validation is reported to apply the same stale collateral-index treatment, extending the same accounting bias to another health-factor gate.

Description

The router’s health-factor accounting applies fresh accrual to debt balances but not to collateral balances. In calculate_user_account_data_unified, collateral is valued with stored reserve_data.liquidity_index, even though reserve state is lazily updated and a reserve may have accrued supply interest since last_update_timestamp. By contrast, debt uses get_current_variable_borrow_index_with_data, so the two sides of the account are measured at different effective timestamps. This understates total_collateral_base, available_borrows_base, and health_factor for users supplying into untouched reserves, and the same stale-index bias is also reported in validate_swap_health_factor. Because wrapper and validation flows rely on this shared solvency logic, the issue propagates into borrow, withdraw, liquidation, and swap-related authorization decisions.

Root Cause

Collateral valuation paths use stale stored liquidity_index data instead of recomputing the current liquidity index before calling balance_of_with_index.

Impact

Users can be treated as undercollateralized even when accrued supply yield keeps their true health_factor above the liquidation threshold. That can allow premature liquidation and capture of the liquidation bonus from otherwise healthy positions, and it can also incorrectly block withdrawals, borrowing, or swaps until reserves are refreshed.

Proof of Concept

See this gist for full Proof of Concept


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

Collateral valuation paths use stale stored `liquidity_index` data instead of recomputing the current liquidity index before calling `balance_of_with_index`.

Impact

Users could be treated as undercollateralised even when accrued supply yield keeps their true health factor above the liquidation threshold, allowing premature liquidation and bonus capture, and incorrectly blocking withdrawals, borrowing or swaps until reserves are refreshed.

What the attacker needed

User supplies into an untouched reserve; reserve has accrued supply interest

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 tracks how much interest collateral has earned using a number called a liquidity index, which only updates when someone touches that reserve. If the code reads an old copy of that number, it thinks the collateral is worth less than it really is. The health factor is a score showing how safe a loan is, so an artificially low score can make a safe position look unsafe.

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.