UwU Lend Exploit Analysis
Introduction to UwU Lend
UwU Lend is a decentralised finance (DeFi) lending protocol built on the Ethereum blockchain. Launched by 0xSifu, UwU Lend aimed to provide an easy-to-use and efficient platform for decentralised lending and borrowing. The protocol is a fork of AAVE v2, one of the most popular and battle-tested lending protocols in the DeFi space. While UwU Lend retains much of AAVE v2's foundational code, it incorporates several critical modifications to support additional features, such as automated looping and more exotic assets. The codebase was subjected to an audit by the security firm PeckShield last year, which, at the time, did not identify any significant vulnerabilities.
Exploit Summary
On the 10th of June 2024, UwU Lend experienced a significant exploit that led to the loss of over $19Mio. USD worth of crypto assets as first reported by Cyvers. The attacker exploited a vulnerability in the protocol’s price oracles, a critical component that determines the value of assets within the system. One depositor that was hit especially hard, Michael Egorov the founder of Curve lost over 23.5 million CRV ($9.85Mio. USD) that he deposited into UwuLend.
After manipulating the price oracles and draining assets, the hacker deposited CRV into LlamaLend and subsequently borrowed over 8 million crvUSD against it. This allowed the hacker to swap out of CRV at a much better rate as if he did it through a decentralised exchange. Thanks to the effort of arbitrage bots and liquidators the funds borrowed by the hacker were returned to lenders in a process of hard liquidation. A process illustrated in the graphic below provided by Curvecap.
In response to the exploit, UwU Lend paused the protocol within minutes and set borrow and deposit rates to 0% to prevent users' positions from being adversely affected. Additionally, the 0xSifu sent a message to the exploiter and offered a white-hat bounty reward of 20% of the stolen assets if returned, exceeding the market standard of 10%.
Upon discovering the exploit, UwU Lend swiftly paused the protocol within minutes. To mitigate the impact on users, the protocol set the borrow and deposit rates to 0%, ensuring that users' positions would not be adversely affected by the pause. In an attempt to recover the stolen assets, 0xSifu reached out to the hacker, offering a white-hat bounty reward of 20% of the stolen assets if they were returned. This bounty is notably higher than the industry standard of 10%.
Technical Details of the Exploit
The exploit likely originated from a vulnerability in the setup of UwU Lend’s price oracles. It should be noted that the Peckshield audit did not cover Oracles, as UwU Lend assumed a trusted price oracle with timely market price feeds. UwU Lend’s contract, while based on the forked code of AAVE v2, had altered the fallback logic for oracles to borrow assets at one rate and liquidate them at an artificially inflated rate, creating an attack vector that the hacker exploited.
One of the core issues was the reliance on the get_p() method from Curve Pools, which calculates a naive (manipulatable) spot price rather than EMA or TWAP. The attacker took advantage of this by executing a multi-billion USD flash loan, temporarily altering the state of the Curve Pools. UwU Lend's fallback oracle then calculated prices based on these manipulated states. According to Nick Franklin, this manipulation enabled the attacker to borrow sUSDe at a rate of 0.99 and liquidate positions at the artificially inflated rate of 1.03.
In addition, one of the pools had a price_oracle() method being from a previous, not advisable, implementation. Michael Egorov, the founder of Curve Finance, weighed in on the situation, stating: “We don't use them as price oracles, and disadvise to use them as such to anyone who asks.” He further noted that they would have identified the potential issue if consulted by UwU Lend, highlighting the importance of thorough and informed oracle configurations.
Conclusion
The situation remains dynamic, with the DeFi community awaiting an official post-mortem from UwU Lend to provide further insights and clarity on the exploit and subsequent actions.
The UwU Lend exploit underscores the critical importance of rigorous security measures and the potential risks associated with relying on certain price oracle configurations, especially ones not vetted by the broader developer community. The DeFi community must continuously evolve and adapt to new threats, ensuring that protocols remain secure and resilient against such sophisticated attacks. The forthcoming official report from UwU Lend will likely offer valuable lessons and strategies for mitigating similar risks in the future.