Skip to content
Business logic Audit finding Intermediate

Inconsistency in position health checks will lead to the incorrect user liquidations

The protocol uses inconsistent comparison operators when checking position health: adjust() allows debt equal to borrowing power, while getLiquidatableDebt() requires borrowing power strictly greater than debt. This means a position that adjust() considers healthy can still be liquidated.

0rpse Follow with 0xSomeHuntoor, 0xTarnished and 26 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-12-monolith-stablecoin-factory-judging/issues/810

Found by

0rpse, 0xSomeHuntoor, 0xTarnished, 0xc0ffEE, 0xeix, 0xnightswatch, 0xpiken, Aasif, AlexCzm, Bobai23, CovenantGuard_Sec, Hemakhi, KrisRenZo, Le_Rems, LonWof-Demon, Nyxx, Riceee, X0sauce, ZafiN, air_0x, algiz, coffiasd, deadmanwalking, futureHack, itsgreg, nodesemesta, queen, typicalHuman, yaioxy

Summary

The protocol checks account's health differently in liquidate() and in adjust() functions creating a situation where one function shows that a position is healthy while the other one allows for liquidation.

Root Cause

The root cause is the difference in checks between liquidate() and adjust().

Internal Pre-conditions

External Pre-conditions

Attack Path

Users call adjust() - at the end of the call, the position health is checked and it allows for the borrowing power to be >= than the debt. However, the checks in the getLiquidatableDebt() require for the borrowingPower to be strictly > debt.

Impact

Position is liquidatable even when it's healthy.

PoC

Let's take a look at the check in the adjust() function:

https://github.com/sherlock-audit/2025-12-monolith-stablecoin-factory/blob/main/Monolith/src/Lender.sol#L321-322

Solidity
   uint borrowingPower = price * _cachedCollateralBalances[account] * collateralFactor / 1e18 / 10000;
        require(debtBalance <= borrowingPower, "Solvency check failed");

It can be seen that the debtBalance is checked against borrowingPower with <= sign allowing for the full equality between them. Now, the logic in the getLiquidatableDebt() makes the opposite:

https://github.com/sherlock-audit/2025-12-monolith-stablecoin-factory/blob/main/Monolith/src/Lender.sol#L669-670

Solidity
        uint borrowingPower = price * collateralBalance * collateralFactor / 1e18 / 10000;
        if(borrowingPower > debt) return 0;

So it requires for the borrowingPower to be exactly greater than the debt. It basically means that if borrowingPower == debt, then adjust() will show the position as healthy while the liquidate() will allow the liquidation.

Mitigation

Diff
+uint borrowingPower = price * collateralBalance * collateralFactor / 1e18 / 10000;
+if(borrowingPower >= debt) return 0;

The original report as published on Sherlock, by 0rpse. 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.

How it worked

Root cause

The health check in adjust() uses a less-than-or-equal comparison while getLiquidatableDebt() uses a strict greater-than comparison, so the boundary case is treated differently.

Impact

A position that adjust() considers healthy can be liquidated, causing incorrect user liquidations.

What the attacker needed

A position with debt exactly equal to borrowing power

The fix

The comparison in getLiquidatableDebt() should be changed to use >= so that equality is treated as healthy, matching adjust().

How it was found

  1. A user calls adjust() and their position ends with debt exactly equal to borrowing power.
  2. The adjust() solvency check passes because it allows debt <= borrowing power.
  3. Later, getLiquidatableDebt() is called and sees borrowingPower is not strictly greater than debt, so it returns a non-zero liquidatable amount.
  4. The position can then be liquidated even though adjust() treated it as healthy.

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.

A lending protocol lets you borrow against collateral, and it checks whether your debt is still safe compared to what you deposited. Here, two parts of the code use slightly different rules for that check: one says you are safe when debt equals your borrowing limit, the other says you are unsafe in that same case. So a user can be liquidated even though the system just told them their position was fine.

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 0rpse

View all

23 more disclosed reports, best first.

More from Monolith Stablecoin Factory

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.