# Inactive collateral remains counted for new borrowing while liquidation and withdrawal reject the same reserve as AssetNotActive

Deactivated reserve still counts as collateral for new borrows in K2, but liquidation and withdrawal reject it as AssetNotActive, blocking debt seizure.

- Payout: Contest reward
- Severity: medium
- Program: K2
- Credited: abdelhaq16
- Disclosed: 2026-08-20
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2026-04-k2#m-29
- Library page: https://bugbountylibrary.com/r/c4%3A2026-04-k2%3AM-29
- Tags: domain:web3 impact:dos impact:funds-loss kind:contest platform:code4rena sev:medium tech:rust technique:source-review vuln:accounting-error vuln:business-logic vuln:liquidation

**Target:** Lending pool reserve lifecycle / account-data and liquidation validation (Rust contracts)
**Root cause:** The reserve active flag is consumed inconsistently: account-data and borrow validation count inactive reserves as collateral without checking is_active(), while withdraw and liquidation reject them with AssetNotActive.
**Steps:**
1. User supplies asset_a and enables it as collateral.
2. Admin calls set_reserve_active(asset_a, false) via PoolConfigurator; user collateral bit remains set.
3. get_user_account_data still includes asset_a balance in total_collateral_base and available_borrows_base (no is_active check).
4. User borrows active asset_b using inactive asset_a as collateral; borrow succeeds.
5. Position becomes liquidatable; liquidator attempts liquidation with asset_a collateral -> reverts AssetNotActive.
6. User attempts to withdraw asset_a -> reverts AssetNotActive.
**How found:** Code review comparing how the active flag is consumed across account-data/borrow versus withdraw/liquidation consumers, spotting the missing is_active() check in collateral accounting.
**Exploitation:** Borrower uses a deactivated reserve as collateral to mint debt in an active asset and transfer it out, then the position cannot be liquidated via the direct path nor can the collateral be withdrawn, leaving bad debt.
**Insight:** When a lifecycle flag gates actions, audit every consumer of that flag for divergent semantics; a missing check in collateral accounting combined with a strict check in liquidation creates unliquidatable debt.
