Lendf.me Hack
Incident Overview
Lendf.Me exploited due to a bug in the deposit function, allowing the attacker to manipulate their collateral amount and withdraw all available assets from multiple liquidity pools.
The attacker exploited a bug in the deposit function, supply(), in Lendf.Me. The function was hooked by embedding an extra withdraw() function, which allowed the attacker to increase their internal record of imBTC collateral amount without actually depositing the amount. The attacker first deposited a specific quantity of imBTC into Lendf.Me.
However, in the second supply(), the attacker not only supplied 0.00000001 imBTC but also withdrew 290 imBTC within the hook by hijacking the transferFrom() function within doTransferIn(). As a result, 290 imBTC were deducted from the attacker's balance under the integrated withdraw(). When the execution returned to supply(), however, the balance was reset to 290 imBTC.
This allowed the attacker to modify the internal record of the imBTC collateral amount in Lendf.Me. With a big enough collateral value, the attacker was thus able to borrow all available assets from multiple liquidity pools.
The attacker's address:
https://etherscan.io/address/0xa9bf70a4β¦a77822
The transaction behind the attack:
https://etherscan.io/tx/0xae7d664bβ¦74363b
The withdrawal of the funds by the attacker:
https://etherscan.io/tx/0x9a5899d2β¦58c12d
Incident Report
What the Attacker Needed to Succeed
Understanding the prerequisites for this type of attack helps auditors identify protocols that are most at risk and helps developers build better defenses.
What Auditors Should Check
If you're auditing a protocol with similar architecture to Lendf.me, these are the critical security checks that could have prevented this incident (April 2020).
- Verify all logic paths related to Reentrancy / Other are guarded by proper access controls and input validation - see the Reentrancy attack class for patterns
- Check that all state-changing functions follow the Checks-Effects-Interactions (CEI) pattern to prevent reentrancy and logic ordering bugs
- Review privileged functions (owner, admin, governance) for potential abuse vectors - centralization risks should be documented and bounded with timelocks or multi-sigs
Master these auditing techniques with hands-on labs and real exploit scenarios in the Smart Contract Hacking course.
Free TrialFunds Recovery
Recovered
$25.2M
Net Loss
0
Related Attack Classes
The technique used in this hack maps to these vulnerability classes in our security curriculum:
Proof-of-Concept Exploits
On-Chain Evidence & References
Sources & References
Learn to Prevent the Next Lendf.me
The Lendf.me hack is one of many attacks that skilled auditors are trained to detect before deployment. Master real exploit patterns and defense techniques with hands-on Web3 security training.