Bible Network Crypto DeFi Onchain RWA AI Agent Stablecoin CryptoTax DeFAI Chain SAFU AGI Claude Me Claude Skill Claude Cowork
Independent Media
Not affiliated with any project
DeFi Protocol Mechanics, Decoded
defi-bible.com
LATEST
Every Time You Get Sandwiched, You Might Think 'Someone' Is Watching You — Here's What's Actually Happening  ·  The Price on Screen Suddenly Gets Cut in Half, and You Have Only Seconds to Decide — What to Do and Not Do During a Flash Crash  ·  A Protocol Once Had Bad Debt — Permanent Blacklist, or Worth Reconsidering?  ·  How Much of This Token 'Hasn't Been Released Yet' Matters More Than How Much It's Up Right Now  ·  Too Narrow a Range Means High Fees but High Risk Too: How to Pick a Concentrated Liquidity Range You Won't Regret  ·  A Vote Passes and Executes the Next Second — Efficiency or a Vulnerability? Check a DAO's Timelock in Three Minutes
Glossary · Security & Risk

Flash Loan

Security & Risk intermediate

30-Second Version · For the impatient
A collateral-free loan that must be borrowed, used, and fully repaid within a single blockchain transaction; if repayment is not completed before the transaction closes, the entire transaction is rolled back, leaving the lender with zero credit risk.
Full Explanation +
01 · What is this?

What is a flash loan, and why can large sums be borrowed without any collateral?

Traditional lending requires collateral to guard against the risk of a borrower absconding. Flash loans fundamentally redesign this problem by exploiting smart contract atomicity: a transaction either executes completely or rolls back entirely — no in-between state exists.

A borrower can borrow millions of dollars within a single transaction, use the funds for arbitrage, liquidations, or other operations, then repay principal plus fees before that same transaction closes. If the repayment falls short, the smart contract causes the entire transaction to fail and revert — even the borrowing action itself is undone, so the lender's funds never truly left. There is therefore no credit risk whatsoever.

This design allows flash loans to provide massive liquidity without collateral, but requires the borrower to complete the entire capital cycle within a single transaction.

02 · Why does it exist?

How do flash loan attacks work, and what are common attack patterns?

Flash loans are a neutral tool, but attackers can use them to amplify their capital scale within a single transaction, enabling operations impossible with small funds.

A typical attack flow: borrow tens of millions in assets → use those funds to manipulate a shallow market or oracle price → arbitrage or trigger unwarranted liquidations at the distorted prices → repay the loan and keep the profit, all within one transaction.

Common patterns include: (1) Oracle manipulation — using a massive buy order to inflate a DEX spot price, causing a lending protocol that relies on that price to misvalue collateral; (2) Governance attacks — instantly borrowing large amounts of governance tokens, passing a malicious proposal, then immediately repaying; (3) Reentrancy combinations — using flash loans to amplify capital, combined with reentrancy vulnerabilities to withdraw repeatedly.

03 · How does it affect your decisions?

Are flash loans inherently dangerous, or do they have legitimate uses?

Flash loans are fundamentally a frictionless short-term capital tool — whether they're dangerous depends entirely on how they're used.

Legitimate uses include: (1) No-capital arbitrage — when price gaps exist between different DEXs, flash loans enable arbitrage that eliminates those gaps, contributing to market pricing efficiency; (2) Costless position management — users with borrowing positions can borrow funds to repay old loans, swap collateral, and re-borrow, all without needing additional capital; (3) Liquidations — liquidators can borrow funds to complete large liquidations, then repay from the liquidation bonus.

The problem is that flash loans give attackers "temporary possession" of enormous capital, amplifying attacks against protocols with design flaws. Flash loans are not the vulnerability — the poorly-designed protocol is the real problem.

04 · What should you do?

How do protocols defend against flash loan attacks?

Core defensive strategies focus on two directions: eliminating the profit margin for attacks, and invalidating the preconditions attacks rely on.

Main defenses: (1) Time-weighted average price (TWAP) oracles — flash loans complete within a single block; TWAP calculates average prices across multiple blocks, making it impossible for attackers to distort the pricing baseline with a single manipulation; (2) Decentralized oracles like Chainlink — obtaining prices from independent off-chain data sources rather than relying on manipulable DEX pools; (3) Timelocks in governance contracts — after a proposal passes, a delay must elapse before execution, defeating governance attacks that borrow and execute immediately; (4) Strict reentrancy locks — preventing repeated contract calls within the same transaction.

Real-World Example +

The 2020 bZx attack was one of the earliest well-known flash loan attacks. In a single transaction, an attacker borrowed 10,000 ETH, used part of it to open a short ETH position on bZx, then used the remaining funds to heavily buy WBTC — inflating its price relative to ETH in the oracle. bZx then underestimated the losses on the short position, netting the attacker roughly $350,000. The entire attack was completed within a single transaction in seconds.

Common Misconceptions +
✕ Misconception 1
× Misconception: Flash loans are themselves a hacker tool. In reality: Flash loans are legitimate protocol features offered by Aave, dYdX, and other major protocols; legitimate arbitrage, position management, and liquidations all use them. The tool itself is blameless — it's protocols with design flaws that are the real problem.
✕ Misconception 2
× Misconception: Defending against flash loan attacks just requires disabling flash loans. In reality: flash loans are only the tool that amplifies attack scale; the underlying vulnerabilities (manipulable oracles, governance without timelocks) are what actually need to be fixed. Disabling flash loans doesn't eliminate the vulnerability itself.
The Missing Link +
Direct Impact

Flash loans lower the capital barrier for arbitrage and liquidations, enabling people without large capital to perform operations that benefit market efficiency. But they simultaneously allow attackers to temporarily amplify their capital scale at near-zero cost, creating highly leveraged threats against protocols with design flaws. These are two sides of the same feature — it's impossible to keep only the benefits while eliminating the downsides. The protocol response is to fix their own design flaws, not to combat flash loans themselves.

Ask a Question
Please enter at least 10 characters
Related Articles
A Vote Passes and Executes the Next Second — Efficiency or a Vulnerability? Check a DAO's Timelock in Three Minutes
developers · Jul 26
Why 'Waiting to Check the Price' Is Actually Safer: How TWAP Neutralizes Flash Loan Attacks
risk · Jul 25
How Governance Attacks Happen: When Voting Power Can Be Borrowed for a Single Block
protocols · Jul 24
How Flash Loan Attacks Work: A Multi-Million Dollar Heist in One Transaction
risk · Jul 22
More Related Topics