📈 Get daily crypto insights that make you smarter about your money

UniLend Finance Suffers $197,000 Flash Loan Exploit Through Stale Balance Vulnerability

On January 13, 2025, decentralized finance protocol UniLend Finance fell victim to a sophisticated flash loan attack on the Ethereum network, resulting in losses of approximately $197,000. The exploit, detected by the SlowMist MistEye security monitoring system, exposed a critical flaw in how the protocol calculated health factors during asset redemption — one that allowed an attacker to borrow significant assets without maintaining adequate collateral.

The Exploit Mechanics

The core vulnerability resided in UniLend’s redeemUnderlying function, specifically in the checkHealthFactorLtv1 logic. When a user redeemed assets, the contract calculated the borrower’s health factor using the old USDC balance in the liquidity pool rather than the current balance after the attacker’s flash loan deposit. This meant the health factor appeared artificially inflated, tricking the system into believing the user’s lending position remained safe when it was, in fact, severely undercollateralized.

The attacker executed a multi-step exploit that began with pledging 200 USDC to the UniLendV2Pool, obtaining 150,237,398 USDC lendShares. They then used a flash loan to borrow 60 million USDC and 5 wstETH, converting the wstETH to approximately 6 stETH. By depositing these borrowed assets back into the protocol, the attacker obtained corresponding lending shares that dramatically inflated their apparent collateral position.

Affected Systems

The vulnerable contract, deployed at 0xc86d2555f8c360d3c5e8e4364f42c1f2d169330e on Ethereum, contained a logic flaw in the userBalanceOftoken0 function. This function returned stale pool balances when computing the health factor, rather than reflecting the actual state after the flash loan injection. The attacker’s address, 0x55f5f8058816d5376df310770ca3a2e294089c33, executed the primary attack transaction 0x44037ffc0993327176975e08789b71c1058318f48ddeff25890a577d6555b6ba, draining approximately $197,000 worth of assets from the protocol.

At the time of the exploit, Bitcoin traded at approximately $94,516 and Ethereum at $3,135, underscoring that even as the broader crypto market held strong valuations, DeFi protocols remained vulnerable to fundamental smart contract flaws.

The Mitigation Strategy

Following the attack, DeFi security experts recommended several immediate mitigations for UniLend and similar lending protocols. First, health factor calculations must always reference real-time pool balances rather than cached or stale values. Protocols should implement snapshot-based balance checks that capture the exact state at the moment of each transaction. Second, flash loan resistance mechanisms — such as delayed redemption periods or reentrancy guards that prevent borrowing and redeeming within the same transaction block — provide critical protection against this class of attack.

Third, comprehensive smart contract audits from multiple independent security firms remain essential. The UniLend vulnerability was not a novel attack pattern; stale balance exploits have been documented in DeFi since 2020. The fact that such a flaw persisted in a live protocol highlights the ongoing need for rigorous auditing practices.

Lessons Learned

The UniLend exploit reinforces several critical lessons for the DeFi ecosystem. Flash loans remain one of the most potent attack vectors available to malicious actors, enabling capital-efficient exploitation of even minor logical flaws in smart contracts. Protocols that calculate financial metrics using potentially stale state variables are inherently vulnerable, regardless of how sophisticated their overall architecture might be.

The relatively modest $197,000 loss — compared to the multimillion-dollar hacks that dominated 2024 — does not diminish the severity of this class of vulnerability. The same fundamental flaw, if present in a larger protocol with deeper liquidity pools, could result in losses orders of magnitude greater.

User Action Required

Users who had funds deposited in UniLend Finance’s affected pools should immediately check their positions and assess any losses. Even if the exploited contract has been patched, residual risks may persist in forked or similar deployments. Always verify that any DeFi protocol you use has undergone recent, comprehensive security audits and maintains active bug bounty programs. For those seeking safer alternatives, stick with protocols that have been battle-tested across multiple market cycles and that implement flash loan resistance as a core design principle.

This article is for informational purposes only and does not constitute financial or investment advice. Always conduct your own research before engaging with any DeFi protocol.

🌱 FOR BUSINESSES BitcoinsNews.com
Reach 100K+ Crypto Readers
Sponsored content, press releases, banner ads, and newsletter placements. Put your brand in front of Bitcoin's most engaged audience.

24 thoughts on “UniLend Finance Suffers $197,000 Flash Loan Exploit Through Stale Balance Vulnerability”

  1. checking pool balance before a flash loan deposit instead of after is such a basic error. UniLends redeemUnderlying used stale state and 197K vanished in seconds. audits need flash loan fuzzing as standard

    1. state_drift_kep TOCTOU vulnerabilities keep appearing because auditors test state at rest not state during execution. a flash loan changes pool balance mid-transaction and nobody simulates that path

  2. 200 USDC pledged for 197K extract. thats a 985x return on capital in one transaction. flash loans are the most powerful and most dangerous primitive in defi

  3. stale balance bugs are sneaky. the health factor looked fine on paper because it was checking old pool data. classic time-of-check vs time-of-use

    1. audit_sloth_ the fix is literally one line. fetch fresh pool balance before computing health factor. how this passed review is beyond me

    2. audit_sloth the TOCTOU pattern keeps killing defi protocols. the fix is obvious, query current state not cached state, but auditors keep missing it because the code looks correct in isolation

    3. exactly this. TOCTOU bugs are the gift that keeps on giving in DeFi. every audit misses them until the exploit happens

    4. 函数wrapper_

      audit_sloth_ one line fix and nobody caught it. fresh pool balance vs cached state is day one stuff. audits are theater at this point

  4. SlowMist caught it but how long was the vulnerable code live before detection. weeks? months? the stale balance bug was probably exploitable since deployment

  5. $197K is honestly a small extract by 2025 standards. the real question is how many other lending protocols have the same stale state issue and just havent been probed yet

    1. Mika L. the real number is unknowable. for every exploit caught there are probably 3 more sitting in monero wallets waiting to be laundered

    2. ^ exactly. flash loans let anyone stress test these contracts with zero risk. if slowmist caught this one, how many did they miss

    3. slowmist is good but they catch maybe 1 in 5 bugs. the real question is who is auditing the auditors because the current model is clearly broken

    4. probably dozens. most lending protocols reuse similar health factor logic. if UniLend had this bug, safe bet others do too

    5. Mika L. this is exactly why flash loan fuzzing should be mandatory in every audit. if you arent simulating flash attacks you arent auditing you are rubber stamping

  6. pledged 200 USDC and walked away with $197K. the math on that leverage ratio is insane. health factor checks need to query current balances, not cached ones

  7. TOCTOU vulnerabilities in lending protocols are going to keep happening until auditors test with actual flash loan simulations not just unit tests

  8. 200 USDC pledged and walked away with 197K. thats a 985x return on a flash loan with zero collateral. health factor checks using stale pool data is negligence not a bug

    1. Dee P. 985x return on 200 USDC is the leverage flash loans enable. no other financial primitive lets you do that in a single tx

    2. Dee P. 985x on 200 USDC is the kind of asymmetry that makes flash loans terrifying. one bug review away from a 9 figure drain

  9. 200 USDC collateral to extract 197k. the leverage on the flash loan was insane. UniLends redeemUnderlying basically had an open door with a welcome mat

  10. stale_balance_rat_

    checking old pool balance instead of current state after a flash loan deposit is a day one mistake. UniLends redeemUnderlying function literally used pre-flash-loon numbers to calculate health factor. 197K gone from one line of bad logic

    1. stale_balance_rat_ the TOCTOU pattern keeps killing lending protocols and auditors still miss it. if you arent running flash loan fuzzing in your audit pipeline you are basically ignoring the most common attack vector in DeFi

      1. Tomoko H. flash loan fuzzing should literally be step one in any DeFi audit. if your health factor check can be gamed by a deposit that happens 3 lines earlier its not a health factor its a suggestion

Leave a Comment

Your email address will not be published. Required fields are marked *

BTC$64,668.00-0.8%ETH$1,898.51-1.3%SOL$76.51-0.1%BNB$600.84-1.5%XRP$1.03-1.0%ADA$0.1968-0.4%DOGE$0.0699-0.7%DOT$0.8165+0.7%AVAX$6.55+1.0%LINK$8.30-0.3%UNI$4.01-0.3%ATOM$1.38+0.2%LTC$45.38-2.2%ARB$0.0804+3.4%NEAR$1.65+1.7%FIL$0.7009-1.2%SUI$0.6949-0.1%BTC$64,668.00-0.8%ETH$1,898.51-1.3%SOL$76.51-0.1%BNB$600.84-1.5%XRP$1.03-1.0%ADA$0.1968-0.4%DOGE$0.0699-0.7%DOT$0.8165+0.7%AVAX$6.55+1.0%LINK$8.30-0.3%UNI$4.01-0.3%ATOM$1.38+0.2%LTC$45.38-2.2%ARB$0.0804+3.4%NEAR$1.65+1.7%FIL$0.7009-1.2%SUI$0.6949-0.1%
Scroll to Top