A protocol with tens of millions of dollars in total value locked gets drained in a single transaction. No private keys were stolen. No smart contract was "hacked" in the traditional sense. The attacker didn't even need capital of their own. Within seconds, the funds are gone, and the transaction that did it looks, on the surface, like any other DeFi interaction.

This is the pattern behind most flash loan attacks. They don't rely on stolen credentials or malware. They rely on borrowing enormous sums of money for a few seconds and using that liquidity to bend a protocol's internal logic until it breaks.

Key Takeaways

  • Flash loans let anyone borrow millions of dollars with zero collateral, as long as the loan is repaid within the same transaction
  • The loan itself is not the exploit - it's a tool that removes capital as a barrier to manipulation
  • Attackers use borrowed capital to distort prices, oracle feeds, or governance votes within a single atomic transaction
  • Flash loan attacks expose protocol logic flaws, not weaknesses in the lending mechanism

The Common Misunderstanding

Most people hear "flash loan attack" and assume the loan itself is the exploit - that borrowing without collateral is somehow a bug being abused. It isn't. Flash loans are a legitimate, intentional DeFi primitive, used constantly for arbitrage, collateral swaps, and refinancing.

The misunderstanding is thinking the danger comes from the borrowing. It doesn't. The danger comes from what the borrowed capital is used to do once it's in the attacker's hands, even if only for one transaction.

A flash loan is closer to a magnifying glass than a weapon. It amplifies whatever logic flaw already exists in a protocol. Without that underlying flaw, a flash loan is just an efficient, capital-free way to arbitrage a price difference. With a flaw present, it becomes the mechanism that makes exploiting that flaw economically trivial.

One observation a week on liquidity, flow, and structure. 4 minutes. No price calls.

Subscribe →

What Actually Happens

A flash loan works because of atomicity - the property that a blockchain transaction either fully executes or fully reverts, with no in-between state. Lending protocols exploit this same property to offer uncollateralized loans safely: if the borrowed funds aren't returned (plus a fee) by the end of the transaction, the entire transaction is rolled back as if it never happened. This is explained in more depth in Why DeFi Exploits Keep Happening: Layered Risk Explained.

An attack sequence typically unfolds like this within a single transaction:

  1. Borrow - The attacker takes out a flash loan, often tens of millions of dollars in a stablecoin or major asset, from a lending protocol.
  2. Manipulate - That capital is used to move the price on a thinly-traded pool, distort a price oracle, or acquire enough governance tokens to pass a malicious proposal.
  3. Exploit - A second protocol, one that trusts the now-manipulated price or state, is interacted with under the false conditions. This might mean borrowing against overvalued collateral, triggering a mispriced liquidation, or draining a pool at a manipulated exchange rate.
  4. Repay - The original flash loan is repaid, with interest, from the proceeds of the exploit.
  5. Profit - Whatever remains after repayment is the attacker's gain, extracted in one atomic block with no ongoing exposure to market risk.

The critical detail is that every step happens in the same transaction. There is no waiting period during which the manipulated price could correct itself, and no risk that the market moves against the attacker between steps. Traditional market manipulation requires capital at risk over time. Flash loans compress that risk window to zero.

This is also why flash loan attacks are frequently discussed alongside MEV (Maximal Extractable Value) - the profit available to whoever controls transaction ordering within a block. Searchers and bots constantly scan for these opportunities, similar in spirit to the dynamics described in MEV Sandwich Attacks: The Hidden Tax on DeFi Trades, where transaction ordering itself becomes the extractable resource.

The vulnerability being exploited almost always falls into one of a few categories:

  • Oracle manipulation - A protocol reads price data from a single decentralized exchange pool rather than a time-weighted or aggregated source, making the price trivial to distort with enough capital.
  • Reentrancy or logic gaps - A contract allows a function to be called again before its internal state updates, letting an attacker repeat an action more times than intended.
  • Governance manipulation - Borrowed tokens are used to temporarily meet a voting threshold, pass a proposal, and then be returned before anyone can react.

In each case, the flash loan isn't creating a new weakness. It's providing the capital scale needed to push an existing weakness past its breaking point.

Example from Crypto Markets

A recurring pattern in past DeFi incidents involves a lending protocol that prices collateral using the spot price from a single automated market maker pool. An attacker takes out a flash loan in a stable asset, dumps it into that thin pool to crash or spike the price of a token, then uses the now-mispriced token as collateral to borrow far more than it's actually worth from the lending protocol.

The attacker repays the original flash loan, keeps the excess borrowed funds, and the entire operation - borrow, manipulate, exploit, repay - completes in one block. By the time the price in the manipulated pool reverts back to normal (because arbitrageurs restore it almost immediately), the exploit has already been finalized and settled. There's nothing left to arbitrage against; the damage is already on-chain.

This is structurally similar to the liquidation cascades described in How DeFi Liquidation Auctions Work, except instead of waiting for market conditions to trigger a liquidation, the attacker manufactures the triggering condition directly.

What Traders Can Learn

Understanding flash loan attacks isn't about learning to execute them - it's about understanding how quickly on-chain conditions can be manufactured rather than organically formed. A price spike, a sudden liquidation wave, or an unusual governance vote can all be signs of manipulated conditions rather than genuine market movement, particularly on protocols with thin liquidity or single-source oracles.

This matters for risk assessment. A protocol's TVL or brand recognition says nothing about its resistance to this style of attack. The relevant question is always: what does this protocol trust, and how expensive is it to fake that trust for one transaction? Protocols that concentrate trust in a single price source or a low governance threshold - similar to the concentration risks discussed in How Governance Tokens Concentrate Voting Power - are structurally more exposed, regardless of how much capital is locked inside them.

FAQ

Can flash loans be used without malicious intent?

Yes. The vast majority of flash loans are used for legitimate purposes like arbitrage, debt refinancing, and collateral swaps. The mechanism itself is neutral - it's simply uncollateralized borrowing that must be repaid within the same transaction.

Why can't flash loan attacks be stopped by just banning flash loans?

Banning flash loans would remove one tool for exploiting a vulnerability, but the underlying logic flaw - like a manipulable oracle or a weak governance threshold - would still exist. Well-funded attackers could still exploit it using their own capital, just with more risk and cost.

How do protocols defend against flash loan attacks?

Common defenses include using time-weighted average price (TWAP) oracles instead of spot prices, pulling prices from multiple independent sources, adding delays to governance proposals, and using reentrancy guards in smart contract code.

Are flash loan attacks illegal?

The legal status is unsettled and varies by jurisdiction. Some argue it's exploiting code exactly as written, not "hacking" in a traditional sense, while others treat it as theft. Regardless of legal classification, the economic effect on affected protocols and users is the same.

Related Concepts

Conclusion

Flash loan attacks look dramatic from the outside - millions of dollars borrowed and drained in seconds - but the mechanics are less mysterious once broken down. The loan is simply a tool that removes the capital barrier to exploiting a flaw that was already there, whether in an oracle, a governance system, or a piece of contract logic. The real vulnerability was never the ability to borrow without collateral. Flash loans don't create the vulnerability - they just remove the cost of finding it.