Overview of the Exploit
A vulnerability in a customized FlashLoopAdapter contract used for managing leveraged positions on Aave v3 has been exploited, resulting in an estimated loss of $305,000 for two Safe wallets on the Ethereum network. The incident occurred after an attacker successfully bypassed access controls embedded in the adapter, as reported by blockchain security firm SlowMist.
Details of the Attack
At the center of the exploit was a security flaw that allowed a fraudulent Safe contract to pass as legitimate when it interacted with the FlashLoopAdapter. The attacker leveraged this loophole to access functionalities meant only for authorized wallets, ultimately siphoning off about 114.09 ETH.
The exploit was first detected by Defimon Alerts on October 1st at 15:08:57 UTC.
It is essential to clarify that while the FlashLoopAdapter functions in conjunction with Aave v3, the core protocol itself remained unaffected by this breach. The FlashLoopAdapter was explicitly designed to facilitate the initiation and closure of leveraged positions using Aave v3, thereby allowing Safes with this module enabled to engage in strategies involving borrowed assets and collateral management.
Technical Analysis
SlowMist explained that the issue arose from the adapter’s access control logic within its open and close functions. Instead of thoroughly verifying the legitimacy of the caller, these functions merely checked whether the method ISafe(msg.sender).isModuleEnabled(address(this)) returned true. By deploying a fake Safe contract that was programmed to always return true, the attacker could easily circumvent security.
The attacker executed a series of transactions that not only transferred existing assets from the Safes but also involved a Morpho WETH flash loan. They managed to repay approximately 1,335 WETH worth of debt associated with one of the Safes (address 0xcfedf95a3653a128dfc2e4288758a1a1850d169f). This repayment released the collateral tied to the leveraged Aave position, allowing the attacker to withdraw about 1,306 weETH to an address under their control. Similarly, a second Safe wallet (0xe3b23e47df7cd85876ac6cb05bdb9d7cd5b28520) lost an additional 6.4 weETH through these tactics.
Significantly, both of the affected Safes were owned by the same individual. After the withdrawal, some of the stolen weETH was converted to WETH as the attacker settled their flash loan obligations.
Context and Implications
Previously, an incident involving weak authorization mechanisms in a related Gnosis ecosystem also came to light in September, indicating ongoing challenges with contract security in Ethereum’s decentralized finance landscape.
Aave’s founder, Stani Kulechov, emphasized that the issue pertained solely to the third-party external adapter and had no impact on the Aave v3 protocol itself. He stated, “This is not Aave v3 contract, it’s a third-party external adapter built on top of Aave, with zero effect on Aave v3.”
Overall, this incident underlines the pressing need for robust security measures concerning third-party integrations and modules in the rapidly evolving DeFi space. The exploit not only highlights the vulnerabilities within smart contract architectures but also serves as a cautionary tale for Safes utilizing potentially insecure modules. SlowMist has categorized this occurrence as a smart contract vulnerability, with the total estimated losses reaching approximately $305,000.