# Bad debt is never handled which places insolvency risks on BendDAO

BendDAO never accounts for bad debt after collateral crashes; leftover debt can't be repaid, draining liquidity and permanently DoSing withdrawals.

- Payout: Audit contest
- Severity: high
- Program: BendDAO
- Found by: 0x73696d616f
- Disclosed: 2024-09-03
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-07-benddao-findings/issues/23
- Library page: https://bugbountylibrary.com/r/c4%3A2024-07-benddao%3AH-05
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:code4rena sev:high tech:solidity technique:source-review vuln:accounting-error vuln:dos vuln:liquidation

**Target:** Lending pool liquidation logic (LiquidationLogic.sol)
**Root cause:** Liquidation only clears debt up to available collateral; when debt exceeds collateral value, the residual bad debt has no accounting path and cannot be cleared, leaving the pool insolvent.
**Steps:**
1. Collateral price crashes or debt value spikes so debt > collateral value.
2. ERC20 position: `executeCrossLiquidateERC20()` partially liquidates, clearing only debt backed by collateral; leftover debt remains.
3. ERC721 position: liquidation unprofitable (price based on debt value), so no liquidation occurs and debt is never repaid.
4. Attempting to clear residual debt reverts at LiquidationLogic.sol#L97 because the user has no collateral left.
5. Pool lacks liquidity to honor withdrawals, DoSing them until price recovers.
**How found:** Code review of liquidation flow: noticed ERC20 liquidations allow partial clearing capped by collateral, and ERC721 liquidations are unprofitable, then traced that residual debt has no repayment path and reverts when collateral is exhausted.
**Exploitation:** No direct attacker extraction described; the flaw is a protocol insolvency/DoS condition triggered by normal market price movement, leaving suppliers unable to withdraw.
**Insight:** When auditing lending protocols, check the liquidation path for the debt>collateral branch: verify residual bad debt has an explicit accounting sink (reserve, index adjustment) rather than assuming treasury covers it, since the code may revert before any manual repayment is possible.

