Koinlytics

Flash Loans: Borrow Millions, Repay In One Block

DeFi Conceptsintermediate6 min read
How Aave, Balancer, and dYdX let anyone borrow without collateral. The legitimate uses and the exploit toolkit.

A flash loan is a loan that must be borrowed and repaid within the same blockchain transaction. If the repayment doesn't happen, the transaction reverts as if it never occurred. This makes uncollateralized borrowing safe for the lender.

How it works

  1. Your contract calls Aave: "lend me 10,000 ETH."
  2. Aave sends 10,000 ETH to your contract.
  3. Your contract does whatever it wants with the ETH.
  4. Before the transaction ends, your contract must repay 10,000 ETH + a small fee (0.09% on Aave).
  5. If not, the whole transaction reverts. Aave never lost anything.

Legitimate uses

Exploit uses

Flash loans have powered many DeFi exploits by amplifying position size. Common pattern: borrow $100M, manipulate an oracle-dependent price, exploit a pool that trusts the manipulated oracle, repay loan. Attacker walks with $10-30M profit.

bZx, Harvest Finance, Yearn, Cream Finance, Beanstalk all suffered flash-loan-amplified exploits.

Where the risk actually lives

Flash loans themselves are safe. The risk is protocols that use manipulable oracles or that assume no attacker has $50M of temporary capital. Every DeFi protocol should stress-test for flash-loan attack scenarios.

Powered by Koinlytics · Free crypto education.

Ready to try what you just learned?

Open the Koinlytics dashboard and see the concepts live on your real portfolio.

Launch App