A flash loan is an uncollateralized loan in decentralized finance (DeFi) that must be borrowed and repaid within the same blockchain transaction. If you do not return the principal plus fees before the transaction closes, the entire transaction is reversed and the loan never happened. No credit check, no collateral, and no waiting period. You borrow, execute your strategy, repay, and the whole sequence settles in one atomic block.
Think of a flash loan like a fully refundable wire transfer that expires the moment the operation ends.
Flash loans exist because of how smart contracts and blockchain transactions work. A transaction on Ethereum can contain multiple operations that all execute atomically: either every step succeeds, or every step fails and the blockchain state reverts. Flash loan protocols like Aave and dYdX exploit this by releasing funds at the start of the transaction only if they will be returned before the transaction closes.
This design means the protocol takes on no default risk. If you fail to repay, the loan never occurred. The protocol's capital is perfectly safe regardless of what you were trying to do.
Flash loans have genuine, economically useful applications. Arbitrage is the most common: you borrow a large amount, exploit a price difference between two DeFi protocols, repay the loan, and pocket the difference. The entire cycle completes in under a second.
Collateral swaps are another legitimate use. If your collateral in a lending protocol is an asset you want to replace, a flash loan lets you repay your outstanding debt, withdraw your collateral, deposit new collateral, borrow again, and repay the flash loan, all in a single transaction without ever needing to hold separate cash.
Flash loans have also been weaponized against poorly designed DeFi protocols. Attackers borrow enormous sums, use them to manipulate on-chain price oracles within a single transaction, exploit lending protocols that relied on those manipulated prices, and repay the loan with the stolen funds. The bZx protocol suffered two flash loan attacks in February 2020 totaling approximately $1 million. The Harvest Finance exploit in October 2020 used a flash loan to manipulate stablecoin prices and extract approximately $34 million.
The defense against flash loan attacks is designing price oracles that cannot be manipulated within a single block, using time-weighted average prices rather than spot prices as the reference.
Sources:
https://docs.aave.com/developers/guides/flash-loans
https://www.chainalysis.com/blog/crypto-crime-report-introduction-2024/
https://ethereum.org/en/defi/