QUADRIGA INITIATIVE
CRYPTO WATCHDOG & FRAUD RECOVERY PLATFORM
A COMMUNITY-BASED, NOT-FOR-PROFIT
$198 000 USD
JANUARY 2025
GLOBAL
UNILEND
DESCRIPTION OF EVENTS

UniLend is a decentralized finance (DeFi) platform aiming to democratize blockchain, AI, and DeFi by offering permissionless lending and borrowing functionalities for any ERC20 token. It features isolated dual-asset pools, flexible lending options, and on-chain governance for token holders to manage key parameters. UniLend also introduces Lamaa AI, a platform that enables users to build and launch modular AI agents with blockchain capabilities. Additionally, Numa Network offers a solution to simplify transaction execution and cross-chain intents, addressing issues like gas fees and scheduling. UniLend focuses on empowering its community through governance, allowing users to propose and vote on protocol changes.
The Unilend exploit occurred due to a flawed health factor check in the "redeemUnderlying" function, where the health factor was calculated before collateral transfer, allowing a hacker to manipulate the system and withdraw assets without proper collateral.
According to Nick L Franklin, the Unilend Pool exploit that led to a $200k loss was caused by a flaw in the health factor check in the "redeemUnderlying" function of the smart contract. The issue stemmed from the sequence of operations: LP tokens were first burned, and then the health factor was checked. However, the health factor was evaluated before the collateral tokens were transferred to the user, leading to an inaccurate balance calculation.
When the health factor was checked, the system relied on the current token balance in the pool contract, which included untransferred tokens. As these tokens were not yet transferred when calculating the user’s token balance, it resulted in an inflated balance. This miscalculation was particularly problematic in pools with large liquidity, as the “userBalanceOfToken” function returned a higher "lendBalance" with a small lending share, making it appear that the user had more collateral than they actually did.
A hacker exploited this vulnerability by depositing a massive amount of USDC (60 million) into the lending pool, borrowing stETH, and then withdrawing all the USDC. This allowed the hacker to effectively gain 60 stETH for free, bypassing the intended collateral requirements. The health factor check should have occurred after the token transfer, and to prevent such issues, it was recommended that the "getShareByValue" function use divUp instead of div to avoid rounding errors and ensure more accurate calculations.
In summary, the exploit took advantage of a timing flaw in the health factor check and inaccurate token balance calculations during withdrawal. These issues allowed the hacker to manipulate the system, withdrawing assets without providing adequate collateral.
Tikkala Research: "The root cause is the shares inflation, After burn the LPposition, @UniLend_Finance forgot to remove the underlying tokens which should reduce the token0.balanceOf(address(this)). When it start to count the HealthFactor of the position, it still uses the old balance and allows users to get more collateral (_lendBalance0) than they deposited."
Amount of loss: $ 197,600 (60.672854887643676587 stETH)
The exploit was picked up by multiple blockchain analysts including SlowMist, Tikkala Research, and Nick L Franklin.
"On January 13, 2025, the SlowMist MistEye security monitoring system detected an attack on UniLend, resulting in a loss of ~$197K."
While UniLend publicly acknowledged the attack and claimed to be working with affected users, it was unclear what outcome occurred, if any.
UniLend Finance offered a 20% bounty. It does not appear that the attacker took them up on the offer.
It is unclear if affected user assets were recovered.
UniLend is a decentralized finance (DeFi) platform enabling permissionless lending and borrowing for any ERC20 token, along with features like isolated dual-asset pools, on-chain governance, and the Lamaa AI platform for building blockchain-integrated AI agents. However, a recent exploit occurred due to a flaw in the health factor check within the "redeemUnderlying" function, where the health factor was checked before collateral transfer, allowing hackers to manipulate balances and withdraw assets without adequate collateral. This led to a $198k loss after a hacker exploited the miscalculation by depositing USDC, borrowing stETH, and withdrawing the funds. The vulnerability stemmed from inflated token balances due to unremoved LP positions and improper health factor calculations. Although UniLend acknowledged the attack and offered a 20% bounty, the outcome and whether affected assets were made whole remain unclear.
SlowMist - "We detected that @UniLend_Finance was exploited with a loss of $197.6k. The root cause was that the attacker exploited a vulnerability in the redeem process, manipulating the share price, which led to incorrect calculation of the attac...ter/X (Mar 5)
Exploit Transaction Of 60.672854887643676587 stETH - Etherscan (Mar 6)
Nick L Franklin - "Unilend Pool lost $200k. Root cause is wrong health factor check. In "redeemUnderlying" function, LP tokens are burnt, and then health factor is checked. After that collateral tokens are transferred to user. When checking health...ter/X (Mar 6)
Tikkala Research - "One of the smart contract on Ethereum was hacked. @UniLend_Finance lost about ~61 stETH which is about ~200k." - Twitter/X (Mar 6)
Tikkala Research - "The root cause is the shares inflation, After burn the LPposition, @UniLend_Finance forgot to remove the underlying tokens which should reduce the token0.balanceOf(address(this)). When it start to count the HealthFactor of the ...ter/X (Mar 6)
UniLend Finance - "Important Update on UniLend V2 We’ve identified a security compromise affecting ~$200k (~4%) of the $4.7M TVL on UniLend Platform. UniLend V1 funds are completely SAFU Refrain from depositing into V2 until further notice We’...ter/X (Mar 6)
Ninja Tools - "Big Transfer" - Twitter/X (Mar 6)
Unilend Finance (Mar 6)
