No incentives to write off bad debt when remaining collateral is very small
The report argues that when a liquidation leaves only a tiny amount of collateral, the remaining reward is smaller than the gas cost, so nobody is incentivised to finish the clean liquidation and the bad debt is never written off. The text claims this can leave a pair toxic, with the last user bearing the leftover borrow shares.
Submitted by Lambda
Impact
When a position only has a bit of collateral left (e.g., because a previous liquidateClean call provided just too little shares or the exchange rate just changed), there is no incentive anymore to call liquidateClean again. The maximum amount that a user will get is the remaining collateral balance, which does not cover the gas fees in such cases.
Therefore, the bad debt is never written off, meaning that the mechanism does not work in such cases and these pairs become toxic (as the last user will have to pay for the leftover borrow shares).
Recommended Mitigation Steps
To avoid such scenarios, it should not be possible to remove almost all of the collateral. Consider introducing an upper limit, e.g. 95%. Above this limit, no dirty liquidations would be allowed.
DrakeEvans (Frax) acknowledged, but disagreed with severity and commented:
This is inherent in high gas fee environments. There are significant incentives to avoid this with the clean liquidation fee being 11% higher than the dirty liquidation fee. To create this scenario the liquidator would need to do a dirty liquidation first.
This sort of thing seems unavoidable when gas is present. Aave documentation refers to residual untouched balances as ‘dust’. If the pair is worth recapitalizing then the gas hit will be worth it. It doesn’t appear that there are problems with incentives here.
And there isn’t an obvious QA improvement.
The mitigation adds a gas overhead for rare, mostly harmless boundary cases which does not seem to be prudent when deploying to mainnet.
Value is technically leaked but acknowledgement from sponsor seems appropriate in this case.
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 liquidation logic allows nearly all collateral to be removed in one call, leaving a remainder too small to cover gas for a follow-up clean liquidation.
Impact
The bad debt may never be written off, so the pair could become toxic and the last user may have to pay for the leftover borrow shares; the sponsor notes this is inherent in high gas fee environments and that clean liquidation fees are 11% higher to discourage it.
What the attacker needed
A position near liquidation; a prior dirty liquidation leaving little collateral; gas costs exceeding the remaining reward
The fix
The reporter suggests capping how much collateral a dirty liquidation can remove, for example at 95%, so a meaningful remainder always stays; the sponsor acknowledged but disagreed with severity.
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.
In a lending protocol, a borrower who falls below the required collateral can be liquidated: someone repays part of the debt and receives the borrower's collateral at a discount. This report says that if almost all the collateral has already been taken, the small remainder is worth less than the transaction fee, so no one bothers to finish the job and the unpaid debt stays on the books.
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.