code-423n4 / 2021-04-marginswap-findings

1 stars 0 forks source link

No default `liquidationThresholdPercent` #28

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Email address

mail@cmichel.io

Handle

@cmichelio

Eth address

0x6823636c2462cfdcD8d33fE53fBCD0EdbE2752ad

Vulnerability details

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.

Impact

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.

Recommended mitigation steps

Set a default liquidation threshold like in CrossMarginTrading contracts.