A self-liquidation bug in Alkemi Earn's Compound-derived lending market let an attacker flash-borrow collateral, liquidate its own position for a reward the accounting never actually debited, and walk away with a reported 43.45 ETH (about $89,000, per BlockSec).
Security ·
Logged as “2026-03-10: Business Logic on AlkemiEarn”.
Alkemi Earn Protocol is a Compound-derived lending market on Ethereum, reachable through the proxy at 0x4822D9172e5b76b9Db37B75f5552F9988F98a888, an AdminUpgradeabilityProxy pointing at the implementation 0x85A948Fd70B2b415bdA93324581fb5FfF1293DF7, confirmed on Etherscan. Users supply collateral, borrow against it, and anyone can call liquidateBorrow on an undercollateralised position to repay part of its debt and take the seized collateral at a discount.
BlockSec's weekly incident roundup traces the loss to two faults in that liquidation path rather than one. First, the function that caps how much of a position can be liquidated in one call, calculateDiscountedRepayToEvenAmount(), worked from the protocol's global closeFactorMantissa setting instead of the borrower's actual shortfall, so a position did not need to be underwater at all for a liquidation against it to go through in full. Second, when the liquidator and the borrower were the same address, the contract computed a reduced supply balance and a rewarded supply balance separately from the same starting balance and wrote them to the same storage slot in sequence. The reward write overwrote the reduction, so the deduction of the attacker's own collateral during its own liquidation was lost while the liquidation reward was still credited.
The proof of concept run by DeFiHackLabs against a fork at block 24,626,978 shows the sequence. The attacker's contract took a flash loan of 51 WETH from the Balancer vault at 0xBA12222222228d8Ba445958a75a0704d566BF2C8, unwrapped it to ETH, and called supply on AlkemiEarn with 50 ETH as collateral in the aweth market. It then called borrow for 39.5 ETH, read back its own balance with getBorrowBalance, and called liquidateBorrow against itself, using aweth as both the borrowed asset and the seized collateral. Because of the storage collision, the collateral deduction was overwritten and the attacker kept the liquidation reward without bearing the intended cost. The contract then called withdraw for the maximum balance, wrapped the proceeds back into WETH, repaid the flash loan plus its fee, and sent the remainder to the attacker.
DeFiHackLabs' proof of concept logs the net take at 43.45 ETH. BlockSec's roundup puts the same incident at about $89,000, without stating the ETH-to-dollar conversion it used, so the two figures read as independent estimates of the same haul rather than a confirmed single number. BlockSec's write-up is the independently published account that corroborates the mechanism beyond the proof of concept itself.
No statement from Alkemi about the incident, a pause, a patch, or compensation appears in either the DeFiHackLabs entry or BlockSec's coverage, and the protocol's own listings carry no incident notice. BlockSec's roundup names no attacker address, only the attack transaction; DeFiHackLabs' PoC header lists an attacker address and an attack contract address, which this page does not restate.
The fix implied by BlockSec's description is specific to the two faults named: compute the liquidation cap from the account's real shortfall rather than a single global close-factor constant, and update the borrower and liquidator balances directly on storage rather than copying them into memory variables and writing them back separately, so a self-liquidation cannot collide with its own accounting. A close-factor check that only asks how much of a position can be touched in one call, without asking whether the position is underwater at all, will reproduce the first half of this bug on any Compound fork that copies it unmodified. The same-slot overwrite is a narrower mistake specific to the order in which AlkemiEarn's liquidation function writes its balances.
Query every incident yourself — free, no signup
Updated 8 Nov 2026. Figures are as reported by the sources listed above and are not independently verified.