# Users can prevent getting bad debt by withdrawing just before a liquidation

Borrowers can close their Trove just before a bad-debt liquidation and reopen after, dodging redistributed bad debt and shifting it onto other Troves.

- Payout: Contest reward
- Severity: medium
- Program: Bima
- Credited: santipu
- Disclosed: 2025-02-05
- Write-up quality: 6/10
- Original: https://cdn.cantina.xyz/reports/cantina_competition_bima_december2024.pdf#3.2.10
- Library page: https://bugbountylibrary.com/r/cantina%3Abima_december2024%3A3.2.10
- Tags: domain:web3 impact:funds-loss kind:contest platform:cantina sev:medium tech:solidity technique:race-window vuln:business-logic

**Target:** Liquity-style TroveManager bad-debt redistribution
**Root cause:** Bad debt from a liquidation is redistributed across currently open Troves, but Troves can be closed and reopened instantly, so a user can exit before redistribution and re-enter after.
**Steps:**
1. Observe a pending liquidation that will produce bad debt in a TroveManager.
2. Close your Trove before the liquidation executes (or execute the liquidation yourself).
3. Wait for liquidation to complete and bad debt to be redistributed to remaining open Troves.
4. Reopen your Trove; if borrowing fee < avoided bad debt share, the maneuver is profitable.
**How found:** Reviewer reasoned about the bad-debt redistribution mechanism and noticed Trove close/open has no timelock, enabling exit before redistribution.
**Exploitation:** Bob front-runs the bad-debt liquidation by closing his Trove, lets the liquidation redistribute bad debt to other Troves, then reopens (or stays out to avoid the fee entirely), externalizing his share of the loss onto other borrowers.
**Insight:** In Liquity-style protocols, any per-Trove cost that is socialized at liquidation time (redistribution, fees) can be dodged by exiting before the event and re-entering after; check whether Trove open/close is timelocked relative to liquidation.
