Skip to content
medium DeFi Economic No SWC entry CWE-284

Liquidation Missing Bounds / Self-Liquidation

SAFE-0222 DeFi Economic Checked automatically by the scanner
1

What goes wrong

Liquidation lacks a close-factor cap or health re-check, allowing a full position to be seized in one call, or a borrower to self-liquidate at a favorable bonus to extract the incentive from the protocol.

2

The vulnerable pattern

proof of concept — how it is exploited
// borrower opens a position, then self-liquidates it, collecting the
// 8% liquidation bonus paid by the protocol -> risk-free skim.
3

How to fix it

the pattern that is safe
require(healthFactor(user) < 1e18, "healthy");
require(repay <= debt * CLOSE_FACTOR / 1e18, "too much");
Enforce close factor + health checks; block self-liquidation.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0222 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs