Skip to content
Business logic Audit finding Intermediate

No default liquidationThresholdPercent

The IsolatedMarginTrading contract lacks a default liquidationThresholdPercent, leaving it at zero. As a result, the belowMaintenanceThreshold function always returns true, allowing anyone to be liquidated immediately.

Marginswap

Originally disclosed on Code4rena

The IsolatedMarginTrading contract does not define a default liquidationThresholdPercent which means it is set to 0. The belowMaintenanceThreshold function uses this value and anyone could be liquidated due to 100 * holdings >= liquidationThresholdPercent * loan = 0 being always true.

Anyone can be liquidated immediately. If the faulty belowMaintenanceThreshold function is fixed (see other issue), then nobody could be liquidated which is bad as well.

Recommend setting a default liquidation threshold like in CrossMarginTrading contracts.

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

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 contract omitted initialising the liquidationThresholdPercent variable, so it defaulted to zero.

Impact

Anyone could be liquidated immediately; if the related function is fixed, then nobody could be liquidated, which is also harmful.

What the attacker needed

None

The fix

A default liquidation threshold should be set, as is done in the CrossMarginTrading contracts.

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 or trading system, a liquidation threshold is the point at which a position can be closed to recover borrowed funds. Here, that threshold was never set, so it stayed at zero, meaning every position was considered unsafe from the start. This let anyone trigger a liquidation right away, even for healthy accounts.

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 from Marginswap

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.