DeFi Fundamentals
Flash Loan
An uncollateralized DeFi loan that must be borrowed and repaid within a single blockchain transaction.
A flash loan attack uses uncollateralized, single-transaction borrowing to exploit pricing or logic flaws in DeFi protocols.
A flash loan attack is a type of exploit in decentralized finance where an attacker uses an uncollateralized flash loan to manipulate protocol mechanics and extract value, all within a single atomic transaction. Because flash loans require no upfront capital and must be repaid within the same block, attackers can temporarily command enormous sums — often tens or hundreds of millions of dollars — to bend market conditions in their favor. If any step in the attack fails, the entire transaction reverts, meaning the attacker risks nothing beyond the gas cost of submitting the transaction.
Flash loan attacks have become one of the most significant security concerns in DeFi, responsible for hundreds of millions of dollars in cumulative losses across dozens of protocols since 2020.
A typical flash loan attack follows a predictable sequence, though the specific vulnerability exploited varies from case to case:
The entire sequence happens in a single transaction. If the profit is insufficient to cover the flash loan repayment, the transaction simply reverts as though it never happened.
Flash loan attacks are uniquely dangerous because they eliminate capital requirements for attackers. In traditional finance, market manipulation requires significant resources and leaves a paper trail. With flash loans, anyone with the technical knowledge to write a smart contract can attempt an attack with zero capital risk. This dramatically lowers the barrier to entry for would-be exploiters.
Additionally, the atomic nature of these transactions means they are difficult to detect and prevent in real time. By the time the transaction is mined into a block, the attack is already complete.
Some of the most significant flash loan attacks in DeFi history include the bZx attacks in early 2020, which were among the first to demonstrate the technique and drained roughly $1 million. The Harvest Finance attack in October 2020 extracted $34 million by manipulating Curve pool prices. Pancake Bunny lost $45 million in 2021 through a similar price manipulation strategy. These incidents collectively shaped how the industry thinks about protocol risk and oracle design.
The DeFi ecosystem has developed several defensive strategies:
Despite these improvements, flash loan attacks remain an ongoing threat as attackers continuously find creative new ways to exploit protocol logic, economic assumptions, and oracle dependencies.
Related Terms
DeFi Fundamentals
An uncollateralized DeFi loan that must be borrowed and repaid within a single blockchain transaction.
Risk & Security
Oracle manipulation is an attack that distorts external price feeds to exploit DeFi protocols relying on inaccurate asset valuations.
Risk & Security
Protocol risk is the possibility of financial loss caused by vulnerabilities, design flaws, or governance failures within a DeFi application.
Risk & Security
A smart contract audit is an independent security review of on-chain code designed to identify vulnerabilities before they can be exploited.