Skip to content
Business logic Audit finding Intermediate

Malicious liquidator can intentionally leave dust amount of collateral and won't trigger bad debt handling

TessKimy Follow with pkqs90

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-01-peapods-finance-judging/issues/500

Found by

TessKimy, pkqs90

Summary

Malicious liquidator can intentionally leave dust amount of collateral and won't trigger bad debt handling

Root Cause

The root cause of issue is in FraxlendPairCore contract, _newMinCollateralRequiredOnDirtyLiquidation variable's setter function is commented and now it's equal to 0 by default.

In Fraxlend, this value is used for protecting the position to leave dust amount of collateral while it has still debt on it. Liquidators are incentivized by liquidator fee and they get extra collateral bonus for liquidation. But if there is dust amount of collateral left, no one will liquidate this position to earn dust amount of collateral and the position won't trigger bad debt handling.

Solidity
            if (_leftoverCollateral <= 0) {
                // Determine if we need to adjust any shares
                _sharesToAdjust = _borrowerShares - _sharesToLiquidate;
                if (_sharesToAdjust > 0) {
                    // Write off bad debt
                    _amountToAdjust = (_totalBorrow.toAmount(_sharesToAdjust, false)).toUint128(); 

                    // Note: Ensure this memory struct will be passed to _repayAsset for write to state
                    _totalBorrow.amount -= _amountToAdjust;

                    // Effects: write to state
                    totalAsset.amount -= _amountToAdjust;
                }
            } else if (_leftoverCollateral < minCollateralRequiredOnDirtyLiquidation.toInt256()) { 
                revert BadDirtyLiquidation();
            }

In conclusion, this kind of positions won't trigger the bad debt handling in the pool.

Internal Pre-conditions

  1. Bad debt condition is required in the position

External Pre-conditions

No need

Attack Path

  1. Malicious liquidator will liquidate the position by leaving 1 wei of collateral and the bad debt mechanism won't be triggered

Impact

Position won't be triggered by the liquidators and it will cause insolvency in the pool because withdraw actions will withdraw more assets than it should, the last person who has shares on the pair may lose all of his funds.

PoC

No response

Mitigation

Choose a reasonable value for _newMinCollateralRequiredOnDirtyLiquidation and do not allow liquidators to leave the position's collateral below that value.

The original report as published on Sherlock, by TessKimy. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A medium-severity business logic bug in Peapods. Sherlock made it public on 12 March 2025. Found in the 749 audit contest (finding M-32), also found by 1 other warden.

About Business logic

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

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 TessKimy

View all

6 more disclosed reports, best first.

More from Peapods

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.