Nine months ago, in a Denver convention center, a booth sat empty.
Littered with token stickers, the table was supposed to hold the physical representatives of decentralized finance (DeFi) protocol bZx. It remained empty, however, as the team struggled to make sense of the digital forces twisting their young project.
bZx, as they would come to find out, was 2020â€™s flash loan â€œpatient zeroâ€.
New cases havenâ€™t stopped in the months since then. Take November: $2 million from Akropolis, then $3.3 million from Cheese Bank, followed by $6 million from Value Finance and finally $7 million from Origin Protocol.
Flash loans remain the common thread through all those recent attacks. These DeFi-native tools enable a savvy investor to take out unbacked loans and amass leverage behind a position. For example, Mondayâ€™s Origin Protocol attacker pulled a 70,000 ETH loan from decentralized derivatives platform dYdX. It enabled the attacker to up the amount of loot sucked out of the project.
Yet, while they may be the string connecting these exploits, flash loans are not the cause in and of themselves, industry leaders told CoinDesk.
Oracle manipulation and flash loans
It may not even be fair to characterize the recent DeFi exploits as â€œflash loan attacks,â€ Chainlink co-founder Sergery Nazarov told CoinDesk in an email.
Nazarov said flash loans at their core are just lump sums of capital thrown at success trade positions. The real issue lies with poorly constructed DeFi projects.
â€œWhile many are trying to frame this trend as the result of flash loans, most of these exploits could have been committed by any well-capitalized actor. All a flash loan does is temporarily make anyone a well-capitalized actor,â€ Nazarov said.
Read more: Everything You Ever Wanted to Know About the DeFi â€˜Flash Loanâ€™ Attack
DeFiâ€™s projects are smart contracts deployed to the Ethereum blockchain. They require outside information, namely pricing data, to execute actions baked into each contract.
That pricing information is liable to distortions simply because of how the Ethereum blockchain packages transactions â€“ that is, every 15 seconds. Prices can move every which way in 15 seconds, which forces smart contracts to act on stale data.
Moreover, many DeFi applications rely on in-house pricing oracles created by token reserves, non-decentralized pricing feeds or other ad hoc solutions. For example, Harvest Finance leaned on another DeFi project, Curve Finance, to price its token pools.
In cases like Harvest Finance, interoperability became a negative dependency. A flash loan worth $50 million deviated asset prices temporarily away from the market value, creating an arbitrage opportunity. A project that had a more robust pricing system wouldnâ€™t have fallen prey to the exploit, the theory goes.
Are audits enough?
Another point developers are coming to grips with is that code audits alone donâ€™t make a DeFi project safe.
Speaking with CoinDesk via Whatsapp, Quantstamp CEO Richard Ma said developers need to understand markets themselves, perhaps more so than the code they deploy to the Ethereum blockchain. Quantstamp has audited or consulted on multiple top DeFi projects such as Curve Finance, MakerDAO and SushiSwap, among others.
â€œUnderstanding the products and the business logic is much more time-consuming and important than a straight-up code review,â€ Ma said.
Indeed, Akropolis was audited twice by two separate firms, but still suffered a re-entrancy attack.
This sort of attack occurs when a smart contractâ€™s backdoor is left ajar. The contractâ€™s state â€“ which records how many tokens the contract has, among other things â€“ fails to update quickly enough when tokens are removed, allowing the attacker to move more coins out than okay. Itâ€™s not dissimilar to a lazy bank teller continuing to fork over funds from an overdrawn account.
Read more: Harvest Finance: $24M Attack Triggers $570M â€˜Bank Runâ€™ in Latest DeFi Exploit
Combining audit redundancies with insurance is a step at least one major cryptocurrency investment firm is now urging.
â€œWe are recommending our portfolio companies to get multiple audits from more than one provider,â€ Paul Veradittakit, partner at venture capital firm Pantera, said in an email. â€œWe also think that projects and investors may want to buy insurance to protect themselves.â€
Itâ€™s also notable that none of the top DeFi projects have suffered oracle attacks spurred by flash loans, dYdX founder Antonio Juliano told CoinDesk in a message. Many flash loans used in attacks have originated on his platform, which offers the product without a fee.
He said that â€œthereâ€™s a big divide between the well-engineered projects and others;â€ a divide being fleshed out in real time by flash loans.
â€œIn the same way you wouldnâ€™t blame Ethereum for an implementation detail of the chain being used for an attack, the way flash loans are being used in exploits is the fault of developers building insecure applications, not the flash loans themselves,â€ Juliano said.