1. Home
  2. Flash Loans

Flash Loans

Arcadia Finance hacker used reentrancy exploit, team demands return of funds

In a post-mortem report, Arcadia Finance developers said an attacker stole funds by liquidating a vault before it could perform a health check, interrupting the app's normal flow of operations.

The Arcadia Finance attacker used a reentrancy exploit to drain $455,000 from the decentralized finance (DeFi) protocol, according to a July 10 post-mortem report issued by the app’s development team. A “reentrancy exploit” is a bug that allows an attacker to “re-enter” a contract or interrupt it during a multi-step process, preventing the process from being completed correctly.

The team has sent a message to the attacker demanding the return of funds within 24 hours and threatening police action if they fail to comply.

Arcadia Finance was exploited on the morning of July 10 and drained of $455,000 worth of crypto. A preliminary report from blockchain security firm Peckshield stated that the attacker had used a “lack of untrusted input validation” in the app’s contracts to drain the funds. The Arcadia team had denied this, stating that Peckshield’s analysis was mistaken. However, the team did not explain what they thought the cause was at the time.

The new Arcadia report stated that the app’s "liquidateVault()" function did not contain a reentrancy check. This allowed the attacker to call the function before a health check had been completed but after the attacker had withdrawn funds. As a result, the attacker could borrow funds and not pay them back, draining them from the protocol.

The team has now paused the contracts and is working on a patch to close the loophole.

The attacker first took a flash loan from Aave for $20,672 worth of US Dollar Coin (USDC) and deposited it into an Arcadia vault. Next, they used this vault collateral to borrow $103,210 USDC from an Arcadia liquidity pool. This was accomplished through a "doActionWithLeverage()" function that allows users to borrow funds only if their account can remain healthy by the end of the block.

The attacker deposited the $103,210 into the vault, bringing the total funds to $123,882. They then withdrew all funds, leaving the vault with no assets and $103,210 in debt.

Theoretically, this should have caused all actions to revert, as withdrawing the funds should have caused the account to fail a health check. However, the attacker used a malicious contract to call liquidateVault() before the health check could commence. The vault was liquidated, eliminating all of its debts. As a result, it was left with zero assets and zero liabilities, allowing it to pass the health check.

Since the account passed the health check after all transactions were concluded, none of the transactions reverted, and the pool was drained of $103,210. The attacker paid back the loan from Aave within the same block. They repeated this exploit multiple times, draining a total of $455,000 from pools on Optimism and Ethereum.

In its report, Arcadia's team pushed back against claims that the exploit was caused by untrusted input, stating that this alleged vulnerability was not “the core issue” in the attack.

Related: Circle, Tether freezes over $65M in assets transferred from Multichain

The Arcadia team posted a message to the attacker using the input data field of an Optimism transaction, stating:

“We understand you are involved with Arcadia Finance’s exploit. We're actively working with security experts and law enforcement. Your TC deposits and withdrawals on BNB were a bit too fast, it's hard to hide your identity online these days. We will escalate this with law enforcement in absence of any funds being returned within the next 24 hours.”

In its report, Arcadia claimed it had found some promising leads for tracking down the attacker. “Besides obtaining addresses linked to centralized exchanges, we also uncovered links to previous exploits of other protocols,” they said. “The team is investigating both on-chain and off-chain data to the fullest extent and has multiple leads.”

Exploits and scams have been a continuing problem in the DeFi space in 2023. A July 5 report from Certik stated that over $300 million was lost due to exploits in the second quarter of the year.

US tops global interest in meme coins: CoinGecko report

Bug in Aave V2 Polygon causes some assets to become stuck in contracts

The bug only affects the Polygon implementation, and V3 is unaffected

A bug in an older version of crypto lending protocol Aave is blocking users from interacting with Wrapped Ether (WETH), Tether (USDT), Wrapped Bitcoin (WBTC) or Wrapped Matic (WMATIC) pools on Aave V2 Polygon, preventing assets from being withdrawn from them, according to a May 19 proposal that attempts to fix the bug through a patch. The proposal says that users are currently unable to "supply more of those assets, borrow, repay, or withdraw."

Although withdrawals are currently impossible, the team stated that funds are "perfectly safe," as the bug can be fixed after a governance vote.

The bug only affects Aave V2 on Polygon. AaveV3, which is the most recent version, remains unaffected, as does V2 deployments to Ethereum or Avalanche.

The broken code arose because of a May 16 interest rate curve patch applied to all deployments of V2. The Polygon implementation of V2 uses a slightly different list of function definitions (called an “interface”) for its rate strategy contracts when compared with the Ethereum and Avalanche implementations. But the interest rate curve changes did not take into account this difference, causing the bug to develop only in the Polygon deployment.

The new proposal asks Aave’s governing body, Aave DAO, to approve code changes to only the Polygon version to fix the patch. Voting is scheduled to begin on May 20, and will continue until May 23, the proposal stated.

Related: Aave DAO votes for ‘rescue plan’ to save lost tokens

Aave is most well known for its flash loan feature that allows users to borrow crypto, make trades, and pay back the loans within the same block without requiring collateral. It began on Ethereum, but has been expanding into other networks over the past few years. On April 17, Aave governance voted to deploy the protocol on zkSync Era, a layer 2 of Ethereum that uses zero-knowledge proof technology. On May 8, Aave V3 deployed to the Metis network, which is also a layer 2 of Ethereum.

US tops global interest in meme coins: CoinGecko report

Polygon-Based Decentralized Exchange Quickswap Loses $220K in Flash Loan Exploit

Polygon-Based Decentralized Exchange Quickswap Loses 0K in Flash Loan ExploitOn Monday, the Polygon-based decentralized exchange (dex) Quickswap lost $220K in a flash loan exploit and following the attack, the team detailed the Quickswap Lend platform will be terminated. Quickswap Hacked for $220K, Dex Project Sunsets Lending Platform 2022 has been quite the year for decentralized finance (defi) hacks as billions have been stolen due […]

US tops global interest in meme coins: CoinGecko report

Data Shows BSC Dapps Lost $167 Million Last Month From Flash Loan Attacks

Data Shows BSC Dapps Lost 7 Million Last Month From Flash Loan AttacksBinance Smart Chain (BSC) decentralized applications (dapps) have been hit with a number of flash loan attacks in recent weeks. According to collected data by Rekt, during the last 30 days BSC has lost a total of $167 million from these flash loan exploits. Flash Loan Hackers Prey on Binance Smart Chain Dapps – $167 […]

US tops global interest in meme coins: CoinGecko report

Cream Finance Launches Cross-Protocol Flash Loans

Cross-protocol flash loans are coming to Cream Finance. 

Protocol-to-Protocol Flash Loans on Cream Finance

The lending protocol will allow other protocols to borrow from its pools through its Iron Bank feature. The Iron Bank currently has over $337.9 million in Total Value Locked (TVL). It’s currently integrated with Alpha Homora V2 and Yearn Finance’s Vaults.

Cream is the first project to enable cross-protocol flash loans. 

Leo Cheng, co-founder and project lead at Cream Finance, spoke of the benefits the feature will offer DeFi users. He said: 

“Bringing protocol-to-protocol flash loans to DeFi will increase capital efficiency and provide deeper liquidity for traders looking to access more lucrative lending services across a wider variety of digital assets.”

As it will work in Yearn Finance, strategists will have the ability to use the flash loans to optimize returns on their assets at lower costs (Yearn Finance integrates several protocols, saving users gas fees). In addition to the Ethereum ecosystem, the instant loans will also be available on Binance Smart Chain and Fantom through Cream V1. 

Notably, flash loans on Cream will incur a 0.03% fee—a fraction of the cost of using Aave and Uniswap. It will also include liquidity provider tokens. 

Flash loans allow a trader to borrow an unlimited amount of capital without providing any collateral, as long as they pay back the debt in the same transaction. They’re frequently used in profit-making strategies like arbitrage and collateral swapping. 

They’re also controversial. Flash loans have played a central role in some of DeFi’s biggest attacks. Since Aave pioneered the innovation in early 2020, millions have been lost through hackers leveraging flash loans to capitalize on smart contract exploits. 

This year, Cream Finance has seen rapid growth, briefly halted by an Alpha Finance exploit in February (Alpha integrates Cream, which led to some confusion surrounding the root cause). ALPHA and CREAM plummeted when news of the exploit broke, and Cream’s TVL dropped around 70%. CREAM’s market cap is around $103.1 million today. It’s trading at $152.47.

Disclosure: At the time of writing, the author of this feature owned ETH, ALPHA, AAVE, and several other cryptocurrencies. They also had exposure to UNI in a cryptocurrency index. 

US tops global interest in meme coins: CoinGecko report