Flash-Loan Attack

Learn what flash-loan attacks are, how attackers exploit DeFi protocols using uncollateralized loans, and how to protect yourself.

W
by Werner Vermaak
Expert Verified
November 6, 2024 • 2 minutes read
Flash-Loan Attack

A flash-loan attack exploits DeFi protocols by borrowing large amounts of uncollateralized capital within a single atomic transaction to manipulate markets, distort pricing oracles, or exploit protocol vulnerabilities. These sophisticated Web3 attacks combine instant liquidity with complex transaction logic to drain funds while repaying the loan in the same block, making them risk-free for attackers when successful. Flash loans were originally designed as legitimate DeFi tools for arbitrage and liquidations but have become popular attack vectors.

The bZx flash-loan attacks in 2020, which drained over $1 million by manipulating price oracles through borrowed capital, demonstrated how these atomic transactions could exploit seemingly secure protocols and sparked industry-wide improvements in oracle design.

Flash-Loan Attack Diagram

Attackers borrow significant liquidity from platforms like Aave or dYdX, manipulate asset prices through large trades or oracle manipulation, exploit pricing discrepancies or flawed protocol logic to extract value, and repay the loan plus fees—all within one transaction. If any step fails, the entire transaction reverts, creating a risk-free testing environment for complex exploits.

These attacks often target protocols with inadequate price oracle protections, flawed economic incentives, or insufficient validation mechanisms.

  • Protocols should implement time-weighted price oracles resistant to single-block manipulation, such as Chainlink’s decentralized price feeds or Uniswap’s TWAP oracles
  • Use circuit breakers, minimum liquidity requirements, and multi-block validation for sensitive operations like liquidations
  • Conduct thorough economic stress testing and formal verification of protocol incentive mechanisms
  • Users should research protocol security measures and avoid newly launched, untested DeFi applications
  • Install a Web3 security tool like the Kerberus browser extension to secure yourself pro-actively.

Written by:

W

Werner Vermaak

Werner Vermaak is a Web3 author and crypto journalist with a strong interest in cybersecurity, DeFi, and emerging blockchain infrastructure. With more than eight years of industry experience creating over 1000 educational articles for leading Web3 teams, he produces clear, accurate, and actionable organic material for crypto users. His Kerberus articles help readers understand modern Web3 threats, real-world attack patterns, and practical safety practices in an accessible, research-backed way.

Read more about the author
Browser Extension
Navigate Web3 Fearlessly

Install once & immediately get protected from scams, phishing and hacks. Zero losses for 250k+ users in 3 years. Now with up to $30,000 in coverage.

Get Protected Now
4.8 From 298+ reviews