Pre-auditThree days of senior audit time for $1,500, credited in full toward your Zealynx audit.3 audit days, credited toward your auditSee how →

Self-Liquidation

Liquidating a lending position you control from another account you also control, so you collect the liquidation reward yourself.

Self-liquidation is when the borrower and the liquidator of a lending position are the same person, acting through two accounts or two contracts. On its own it is not an attack. A borrower close to liquidation may liquidate themselves to recover the liquidation discount a stranger would otherwise collect, and a protocol may allow that.

It becomes an attack when the borrower can choose how unhealthy their position is. Liquidation rewards are designed to pay a third party for taking on risk the protocol wants removed. If the borrower can create that risk on purpose and then collect the reward, the protocol is paying them to damage it.

How a self-liquidation attack works

The pattern needs three ingredients. First, a way to build a large position cheaply, often with a flash loan and leverage. Second, a function that lowers the position's health factor without checking it, so the borrower can push it below 1 at will. Third, a liquidation reward large enough that buying the bad position at a discount is worth more than it costs, especially a discount that grows as the position gets sicker.

The Euler Finance hack of March 2023 combined all three. The attacker used a flash loan and Euler's self-borrowing mint to build hundreds of millions of collateral and debt, donated their own collateral through donateToReserves, which had no health check, and then liquidated the underwater account from a second contract at Euler's maximum discount. The difference was left behind as bad debt.

Preventing it

The main defence is the health check: every function that can lower a user's collateral or raise their debt must revert if it leaves the account unhealthy. That removes the borrower's ability to choose their own health. Beyond that, review whether your liquidation reward can ever exceed the cost of making a position unhealthy, and test the question directly: can any sequence of a user's own calls end in a profitable liquidation of themselves?

Need expert guidance on Self-Liquidation?

Our team at Zealynx has deep expertise in blockchain security and DeFi protocols. Whether you need an audit or consultation, we're here to help.

Get a Quote