Skip to content
Business logic Audit finding Intermediate

Base calculation in `Leverager::isLiquidateable()` is incorrect as the max leverage may be smaller

The liquidation check in Leverager uses the vault's max leverage instead of the lending pool's lower max leverage, underestimating the base amount. This can prevent users from being liquidated when they should be, causing the protocol to take losses and risk bad debt.

0x73696d616f Follow with future2_22 and iamnmt

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-02-yieldoor-judging/issues/158

Found by

0x73696d616f, future2_22, iamnmt

Summary

Base calculation in Leverager::isLiquidateable() is: uint256 base = owedAmount * 1e18 / (vp.maxTimesLeverage - 1e18);. However, the max leverage may not actually be vp.maxTimesLeverage, but be maxLevTimes from the lending pool. In this case, the base amount would be incorrectly underestimated, leading to users not being liquidated when they should for the protocol's loss (loss of profit and higher bad debt risk).

Root Cause

In Leverager:408, the max leverage from the lending pool is not taken into account.

Internal Pre-conditions

maxLevTimes from the lending pool < vp.maxTimesLeverage.

External Pre-conditions

None.

Attack Path

  1. User has a position that should be liquidated but isn't due to the rhs of the is liquidatable check.

Impact

Protocols takes losses and risks bad debt creation.

PoC

If maxLevTimes < vp.maxTimesLeverage, it means the base calculation would have in the divisor a bigger number than it should, so base will be smaller. As base is smaller, the collateral of the user can decrease more without the user being liquidated.

Mitigation

Compare the 2 max leverage values and use the smallest, which is the actual maximum leverage allowed in the Leverager.

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

Likely the liquidation check uses the vault's max leverage instead of the lower max leverage from the lending pool, causing the base to be underestimated.

Impact

The protocol could take losses and risk bad debt creation because positions that should be liquidated are not.

What the attacker needed

MaxLevTimes from lending pool < vp.maxTimesLeverage

The fix

The two max leverage values should be compared and the smallest used, as that is the actual maximum leverage allowed in the Leverager.

How it was found

  1. A user has a position that should be liquidated but isn't due to the right-hand side of the is-liquidatable check.

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 decides if a user's position is unsafe by comparing their debt to a calculated base amount. The calculation used the wrong maximum leverage value, making the base too small, so risky positions were not flagged for liquidation. This could leave the protocol with unpaid debt.

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

View all

172 more disclosed reports, best first.

More from Yieldoor

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.