Home/Learn/Scam Detection
Scam Detection7 min readApril 18, 2025

What Is a Flash Loan Attack? How DeFi Exploits Work and How to Stay Safe

Flash loan attacks have drained hundreds of millions from DeFi protocols. Learn how they work, which protocols are vulnerable, and what red flags to look for before investing.

Flash loan attacks are one of the most sophisticated exploit vectors in DeFi. In 2023 and 2024, flash loan attacks drained over $500 million from protocols including Euler Finance ($197M), Platypus Finance ($8.5M), and dozens of smaller AMMs. Unlike traditional hacks, flash loan attacks require no upfront capital — making them accessible to any developer with the right knowledge.

What Is a Flash Loan?

A flash loan is an uncollateralized loan that must be borrowed and repaid within a single blockchain transaction. If the loan is not repaid by the end of the transaction, the entire transaction reverts — meaning the lender never loses funds. Flash loans are a legitimate DeFi primitive used for arbitrage, collateral swaps, and liquidations. But they can also be weaponized.

How a Flash Loan Attack Works

  1. 1The attacker borrows a massive amount of tokens (e.g., $50M in ETH) from a flash loan provider like Aave or dYdX — no collateral required.
  2. 2The attacker uses the borrowed funds to manipulate a price oracle. For example, they dump a large amount of a token into a liquidity pool, crashing its price on that specific DEX.
  3. 3The attacker exploits a vulnerable protocol that reads its price data from the manipulated DEX. They borrow against the artificially deflated collateral or drain a liquidity pool at the wrong price.
  4. 4The attacker repays the flash loan with a small portion of the stolen funds, keeping the profit.
  5. 5The entire attack happens in a single transaction — often in under 13 seconds (one Ethereum block).
Key vulnerability: Protocols that use a single DEX as their price oracle (instead of a time-weighted average price or Chainlink) are highly vulnerable to flash loan price manipulation.

Which Protocols Are Most Vulnerable?

  • Lending protocols with single-source price oracles (not Chainlink or TWAP)
  • AMMs with low liquidity that can be easily manipulated with a large trade
  • Protocols with reentrancy vulnerabilities in their withdraw or borrow functions
  • Yield aggregators that automatically rebalance based on real-time price data
  • Newly launched protocols that have not been battle-tested or audited for oracle manipulation

How to Evaluate Flash Loan Risk Before Investing

  1. 1Check the oracle source — Does the protocol use Chainlink, a TWAP oracle, or a single DEX spot price? Single DEX spot prices are dangerous.
  2. 2Read the audit report — Reputable auditors specifically test for flash loan attack vectors. Look for findings related to 'price manipulation', 'oracle dependency', or 'reentrancy'.
  3. 3Check protocol TVL and liquidity depth — Higher TVL makes manipulation more expensive and less profitable for attackers.
  4. 4Look for bug bounty programs — Protocols that offer substantial bug bounties (>$100K) attract white-hat researchers who find vulnerabilities before attackers do.
  5. 5Check the protocol's incident history — Has it been exploited before? How did the team respond? A transparent post-mortem and rapid fix is a positive signal.

How GoldenBit.ai Detects Flash Loan Vulnerability Signals

GoldenBit.ai's Smart Contract Audit pillar analyzes EVM bytecode for reentrancy patterns and checks for known vulnerable oracle patterns. The Liquidity & Market Health pillar monitors for abnormal trading patterns that may indicate price manipulation testing. While no automated tool can guarantee detection of all flash loan vectors, GoldenBit.ai provides a strong first-pass risk signal.

Scan any DeFi token for smart contract vulnerabilities and oracle risk.

// SECURITY_UPDATES

Get Notified When We Publish New Guides

New crypto security guides, rug pull alerts, and DeFi risk analysis — delivered to your inbox. No spam, unsubscribe anytime.

KEYWORDS
flash loan attackDeFi flash loan exploithow flash loan attacks workDeFi exploit explainedflash loan vulnerability
// RECENTLY_SCANNED_TOKENS

Apply what you just learned — scan these recently analyzed tokens.