If you spend any time reading about DeFi hacks, you will eventually run into the phrase "flash loan exploit." It sounds exotic, but the underlying idea is simple once you separate it into its two parts. A flash loan is a tool for borrowing without collateral. A price oracle is how a protocol learns what an asset is currently worth. Neither one is dangerous on its own. Put together carelessly, they have been behind some of the costliest exploits in DeFi history.
What a flash loan actually is
A flash loan lets someone borrow a large amount of crypto with no upfront collateral, on the condition that the loan is borrowed and repaid within a single transaction. If the borrower cannot repay by the end of that transaction, the entire transaction reverts as if it never happened, so the lender never actually takes on credit risk. Our guide to what a flash loan is covers the mechanics in more detail. The part that matters here is scale. A flash loan can temporarily hand someone millions of dollars in trading capital that they do not own and never need to pay for if their plan fails.
Why protocols need price oracles at all
Lending markets, synthetic assets, and many other DeFi protocols need to know the current price of the assets they hold, so they can calculate how much someone can borrow, when a position should be liquidated, or how much a vault share is worth. That price comes from a price oracle, a feed that reports market data back to a smart contract. Our guide to what a price oracle is and our guide to TWAP oracles explain the different ways protocols try to source that number reliably. The simplest and most fragile approach is reading the current spot price straight out of a single liquidity pool.
How the two combine into an attack
The attack pattern is consistent across most of the well known cases. In a single transaction, an attacker borrows a very large sum through a flash loan, then uses part of it to push the price in a thinly traded pool far away from its real market value. If a lending or vault protocol happens to read its price directly from that same pool, it briefly sees the distorted price as genuine. The attacker then borrows against artificially inflated collateral, or redeems a vault share at an inflated value, pulls out real assets, repays the flash loan, and keeps the difference. All of this happens atomically, inside one transaction, so there is no window where anyone else could react before it is already done.
Without a flash loan, pulling this off would require the attacker to actually own enough capital to move the market, which exposes them to real financial risk if the trade goes wrong. The flash loan removes that risk entirely, which is why this specific combination became so common.
Real cases worth knowing
Harvest Finance, October 2020. An attacker took a large flash loan and used it to skew prices across Curve stablecoin pools that Harvest's yield strategy relied on for valuing its vaults. By trading back and forth between Uniswap, Curve, and Harvest within one transaction, the attacker was able to redeem vault shares at a distorted price, draining tens of millions of dollars from depositors before the price corrected itself.
Cream Finance, October 2021. This exploit targeted how the protocol calculated the value of its own vault tokens, which depended on data read from other connected contracts. By manipulating that underlying calculation, an attacker was able to push the reported price of vault tokens up and borrow far more than the collateral was actually worth, resulting in a loss of roughly 130 million dollars.
It is also worth knowing what this pattern is not. The 2022 Mango Markets incident is frequently mentioned alongside flash loan attacks, but it worked differently. The attacker used his own funds across two accounts to directly pump the spot price of a thinly traded token on the exchanges that fed Mango's oracle, rather than using a single flash loan transaction. The lesson is the same either way, a protocol that trusts a price feed without asking how easy that feed is to move is exposed, whether the capital behind the manipulation was borrowed for a second or held for longer.
How protocols try to prevent this
The fixes that have held up well share a common theme, make the price harder and more expensive to move in the short window an attacker has. Common approaches include averaging a price over time with a TWAP rather than reading an instant spot price, pulling data from independent oracle networks like Chainlink instead of a single on-chain pool, requiring agreement across multiple price sources before accepting a value, and adding circuit breakers that pause unusual activity. None of these make manipulation impossible, but they make it dramatically more expensive and slower to pull off, which is often enough to make an attack unprofitable.
What this means if you use DeFi on Base
You are very unlikely to ever take out a flash loan yourself, but the protocols you lend to, borrow from, or deposit into on Base may depend on oracles that could be attacked this way. Audits help, but as the Cream Finance case shows, an oracle design flaw can pass an audit and still be exploitable later. Before putting meaningful funds into a lending market or yield vault, it is worth checking what kind of price feed it actually relies on, something project documentation or a quick search usually answers, alongside the basics covered in our guide to researching a token or protocol before you use it. A protocol that relies on deep, independent oracle sources is structurally safer than one trusting a single thin pool, regardless of how large its total value locked looks on the surface.
The short version
A flash loan and a price oracle are each ordinary DeFi tools on their own. The exploit pattern behind some of the largest hacks in DeFi history comes from combining them, borrowing a huge sum for a single transaction, using it to distort a price feed, and cashing out before the price corrects. Protocols defend against this with time averaged prices and independent oracle networks rather than trusting a single pool's current price. As a user, the practical takeaway is simple, a protocol's oracle design is as important to its safety as its audit history.
Sources: Top Oracle Manipulation Hacks in DeFi, Halborn, How to Hack Harvest Finance for $24M, Ginger Security, Hack Analysis: Cream Finance Oct 2021, Immunefi, DeFi Attacks: Flash Loans and Centralized Price Oracles, Glassnode