1 Introduction
A flash loan attack exploits a feature unique to decentralized finance: the ability to borrow a very large, uncollateralized sum that must be borrowed and repaid within a single atomic blockchain transaction. Because the loan only needs to be solvent at the end of the transaction, an attacker can command tens of millions of dollars for a few milliseconds. The attacker uses that temporary capital to skew the price in a thin automated market maker (AMM) pool or a price oracle, tricks a victim protocol into trusting the manipulated price, extracts value, and repays the loan in the same transaction. If any step fails, the entire transaction reverts and the attacker simply loses gas.
1 tx
Borrow, manipulate and repay in a single atomic transaction
$0
Collateral required to borrow the loan
Tens of millions
Drained from DeFi protocols in single transactions
2 Interactive Atomic Transaction Walkthrough
Single Atomic Transaction
AMM Pool Price vs. True Market Price
Step 1 - Loan Requested: The attacker calls a lending pool and borrows $100M with no collateral. The pool releases the funds on the condition that they are returned before this same transaction ends. Nothing has been manipulated yet.
3 Detailed Analysis
Why Atomicity Is the Weapon
The Flash Loan
An uncollateralized loan that only has to be solvent at the end of one transaction. It grants an attacker enormous, risk-free capital for the duration of a few function calls, with no credit check and no down payment.
The Price Oracle
Protocols that read a price directly from a single AMM pool can be fooled. A large trade temporarily moves the spot price, and any contract that trusts that instantaneous figure values collateral incorrectly.
Legal & Regulatory Framework
Flash loans themselves are lawful; liability turns on what the borrowed capital is used for. In the US, the CFTC and DOJ have treated manipulating a DeFi protocol's price oracle to borrow against inflated collateral as commodities manipulation and fraud, as in the Mango Markets case below, and exploits can also be charged as wire fraud (18 U.S.C. §1343). In the EU, MiCA Art. 91 prohibits manipulating crypto-asset prices under MiCA's market-abuse title (Arts. 86-92), which has applied since 30 December 2024, but it applies to crypto-assets admitted to trading or for which admission has been requested, and MiCA leaves services provided in a fully decentralised manner outside its scope.
Detection Methodology
The flash-loan step lives inside one transaction, so traditional account-monitoring cannot stop it, although many DeFi exploits also involve preparatory or follow-on transactions that can be monitored. Defenders instead analyze transaction traces and mempool activity for the tell-tale shape: a large borrow from a lending pool, an immediate outsized swap against a low-liquidity pool, an interaction with a separate protocol at a skewed valuation, and a repayment, all in the same block. On-chain analytics also watch for instantaneous price deviations between an AMM spot price and time-weighted or external reference prices, since a healthy market does not move tens of percent and snap back within one transaction.
Notable Cases
bZx attacks (2020) - Academic analysis, Qin et al.
In February 2020 two attacks on the bZx lending protocol used flash loans to manipulate prices across DeFi venues, among the first widely studied flash-loan exploits. Researchers found both had returns on investment above 500,000%, and showed the parameters could have been tuned to earn about $829,500 and $1.1 million.
DeFi exploits warning (2022) - FBI IC3, United States
The FBI reported that about $1.3 billion in crypto was stolen in the first quarter of 2022, roughly 97% of it from DeFi platforms. Among its examples, one attacker used a flash loan to trigger a smart-contract flaw, costing about $3 million, and another manipulated a single price oracle to take about $35 million.
Mango Markets (2022) - CFTC / DOJ SDNY, United States
Avraham Eisenberg allegedly pushed the oracle-reported price of the MNGO token up more than 13-fold in 30 minutes, then borrowed against the inflated collateral and withdrew over $110 million, later returning about $67 million. It was the CFTC's first oracle-manipulation case; the attack used the attacker's own capital rather than a flash loan but exploited the same oracle weakness.
Red Flags
- A large uncollateralized borrow and full repayment occurring within a single transaction
- An AMM spot price deviating sharply from time-weighted or external reference prices, then reverting
- A protocol pricing collateral from a single low-liquidity pool that is cheap to move
- One transaction touching a lending pool, a thin AMM pool, and a victim protocol in rapid sequence
4 Sources & Further Reading
- Attacking the DeFi Ecosystem with Flash Loans for Fun and Profit - Qin et al., arXiv:2003.03810
- SoK: Decentralized Finance (DeFi) Attacks (IEEE S&P 2023) - Zhou et al., arXiv:2208.13035
- DeFi risks and the decentralisation illusion (BIS Quarterly Review, Dec 2021) - Bank for International Settlements
- Cyber Criminals Increasingly Exploit Vulnerabilities in Decentralized Finance Platforms - FBI / IC3
- Regulation (EU) 2023/1114 on markets in crypto-assets (MiCA) - EUR-Lex
- 18 U.S.C. § 1343 - Fraud by wire, radio, or television - Legal Information Institute, Cornell Law School
- CFTC Charges Avraham Eisenberg with Manipulative and Deceptive Scheme to Misappropriate Over $110 Million from Mango Markets - U.S. CFTC
Links point to primary legislation, regulators, international bodies and official enforcement records. Always check the current version of a text before relying on it.
Related Fraud Types
Honeypot Tokens
Deploying tokens with hidden code that lets victims buy but blocks them from selling, trapping their funds.
Rug Pull
Developers abandoning a project and running away with investor funds after attracting significant capital.
Market Manipulation
Artificially inflating or deflating the price of a security or otherwise influencing market behavior for personal gain.
Source: FraudCodex - Educational Platform for Financial Crime
URL: https://fraudcodex.org/page/flash-loan-attack
Page: Flash Loan Attacks - Market Abuse / Crypto & Digital Assets
Disclaimer: This content is for educational purposes only and does not constitute legal advice.