The $6 Billion Mistake

Flash Loan Attack Explained: How Hackers Steal Millions in a Single Transaction

An attacker borrowed $200 million, manipulated a market, drained a protocol, repaid the loan, and kept $30 million in profit — all in a single blockchain transaction that took about 15 seconds. No collateral. No bank. No criminal record required. No trace of the loan by the time the block closed.

This is what a flash loan attack explained in plain English looks like. And understanding it is one of the most important things you can do before putting money into any DeFi protocol.

What Flash Loans Are (The Legitimate Version)

A flash loan is a type of loan that only exists in the blockchain world. It requires no collateral — but there’s a fundamental catch: you must borrow and repay the entire loan within the same transaction block.

On a blockchain, a single transaction can contain multiple steps that execute in sequence. If any step fails, the entire transaction reverts — it’s as if it never happened. Flash loans use this mechanic as their security model. If you borrow $100 million but don’t repay it by the end of the transaction, the loan simply never executes. The blockchain cancels everything and nobody loses anything.

This is why no collateral is needed: the lender has zero risk. You literally cannot run away with the money, because the money only exists within the transaction. Legitimate uses of this technology include:

  • Arbitrage: If ETH trades at $3,000 on one exchange and $3,010 on another, a trader can borrow millions, buy on the cheap exchange, sell on the expensive one, repay the loan, and keep the spread — automatically, in seconds.
  • Collateral swaps: Replacing one type of collateral with another in a single step, without needing the cash upfront.
  • Liquidations: Earning liquidation bonuses by repaying undercollateralized loans on behalf of lenders.

Flash loans are available through protocols like Aave and Uniswap V3. The tools themselves aren’t inherently dangerous. The danger comes when they’re combined with a protocol that has a specific type of design flaw.

How Attackers Weaponize Flash Loans — the DeFi Flash Loan Hack Pattern

Flash loans give anyone — with zero upfront capital — temporary access to enormous sums. A hacker with $0 in their wallet can briefly control $200 million. That’s not a hypothetical. That’s how these attacks are funded.

The attack pattern typically unfolds like this:

  1. Borrow a massive amount via flash loan (e.g., $200M in ETH)
  2. Use those funds to manipulate the price of a token on a thinly-traded exchange
  3. Exploit a lending protocol that uses that manipulated price as its price oracle
  4. Extract the profit from the protocol
  5. Repay the flash loan
  6. Keep the difference

The entire sequence happens in one atomic transaction. If the attacker can’t generate enough profit to cover the loan repayment, the transaction reverts and nothing changes (except the attacker paying gas fees for the attempt). This is a DeFi flash loan hack enabled not by breaking cryptography or stealing keys, but by exploiting a specific vulnerability in how protocols read price data. That vulnerability has a name.

Price Oracle Manipulation: The Hole Attackers Crawl Through

An oracle, in DeFi, is the data source a protocol uses to determine what an asset is worth right now. If you’re running a lending protocol and users want to borrow against their ETH as collateral, you need to know what ETH is worth at this moment. You check an oracle. The oracle tells you. Simple — until someone games the oracle.

Vulnerable oracle: Reads the price directly from a single decentralized exchange (DEX) spot price. If someone executes a massive trade on that DEX, the price spikes temporarily. The oracle reads the spike. The lending protocol gets fooled into treating artificially inflated collateral as legitimate.

Secure oracle: Uses Chainlink (an aggregated feed from many independent, geographically distributed sources) or a TWAP (time-weighted average price), which calculates the average price over multiple blocks. A single large trade can’t spike a TWAP fast enough to make the exploit profitable.

Price oracle manipulation works because flash loans make it cheap to move prices on thin markets. A hacker can inflate a token’s price 10x within a single block, borrow against that fake collateral value, drain the lending pool, and repay the flash loan — all before the price reverts to normal. The manipulation window is seconds, which is all a flash loan needs. If a protocol relies on a single DEX spot price as its oracle, it is vulnerable to this attack. That’s not an edge case. That’s a design flaw waiting to be exploited.

Real Examples: Flash Loan Attacks That Actually Happened

These aren’t theoretical scenarios. Here are three real incidents that drained hundreds of millions of dollars:

Beanstalk Protocol (April 2022) — $182 million lost
This one was particularly creative. The attacker used a flash loan to temporarily acquire a majority of Beanstalk’s governance tokens. Within the same transaction, they used that majority to pass a malicious governance proposal transferring the protocol’s entire treasury to their wallet — then repaid the loan. The protocol’s own voting system was weaponized to empty it. One block. One transaction.

Harvest Finance (October 2020) — $34 million lost
The attacker flash-loaned into a stablecoin price manipulation on Curve Finance, then exploited Harvest Finance’s vaults, which used those manipulated prices as their oracle. The cycle repeated multiple times within a single transaction until the vault was drained.

Cream Finance — approximately $150 million across multiple incidents
Cream Finance was hit several times over 2021 and 2022, each incident involving oracle manipulation or lending logic vulnerabilities amplified by flash loans. The protocol eventually shut down its V1 lending markets entirely.

The common thread across all of these: protocols that trusted easily manipulable price sources, combined with flash loans that made the manipulation cheap enough to execute at a profit.

What You Can Actually Do About This

You cannot stop a flash loan attack from the outside. This is a protocol-level vulnerability, not a user error. Choosing a strong password won’t help. Using a hardware wallet won’t help. Being careful with your seed phrase won’t help. If money is sitting in a DeFi protocol with a vulnerable oracle and it gets hit, those funds can be gone — no FDIC insurance, no fraud department to call, no undo button.

What you can do is choose not to deposit into protocols with these vulnerabilities in the first place. As we covered in our DeFi protocol audit guide, oracle quality is one of the first things to check before depositing anything.

Green flags: Chainlink price feeds (aggregated, manipulation-resistant), TWAP oracles, audits that specifically test for oracle manipulation (not just general code review), and years of track record without oracle-related incidents.

Red flags: Single DEX spot prices used as oracles, thin liquidity on the reference exchange, no documentation explaining the oracle design, and large TVL on a recently launched protocol with only one audit.

To check: search “[protocol name] oracle” and read what comes up. Oracle design is usually mentioned in documentation or audit reports. If you can’t find it, that opacity is itself a red flag.

DeFi Composability: The Double-Edged Sword

DeFi’s composability — protocols interacting with each other — is what makes the whole ecosystem powerful. It’s also what makes flash loan attacks possible. A hacker can borrow from Aave, manipulate a price on Uniswap, and exploit a third protocol, all in one combined transaction that wouldn’t exist in traditional finance.

Flash loan crypto risk isn’t that flash loans themselves are bad. It’s that composability means every protocol’s security depends partly on every protocol it touches. A well-designed protocol can still be exposed if it accepts collateral from a protocol with a weaker oracle. Security is only as strong as the weakest link in a composable chain.

This is why established protocols with long track records, multiple audits, and conservative oracle designs tend to be worth the slightly lower yields they often offer. You’re paying for battle-tested security and the right to ask whether anyone has tried — and failed — to break this before.

The Takeaway

Flash loan attacks follow a predictable pattern: borrowed capital, price oracle manipulation, protocol exploit, repayment, profit. Once you understand the pattern, you know exactly what to ask before depositing.

The question: Where does this protocol get its price data? Chainlink and TWAP oracles are safer. Single DEX spot prices are red flags. And if the protocol can’t answer that clearly in its documentation, that tells you something too.

Next time you evaluate a DeFi protocol, search “[protocol name] oracle” and read what comes up. It takes five minutes and it’s one of the fastest ways to gauge whether the team actually thought about this category of risk — or just hoped no one would exploit them.


Want more straight talk on staying safe in crypto? Subscribe to Crypto Clarified — our free weekly newsletter on staying safe in crypto.

Want the full DeFi research every Friday? Wednesday scam alerts + Friday deep dives — premium newsletter, $9/month.
Upgrade to Premium →