The Two Ways an Oracle Breaks
You're watching a lending protocol's collateral price when it does something impossible: it triples in twelve seconds, then snaps back as though nothing happened. The block closes. The attacker is already gone. The protocol is holding undercollateralized debt it will never recover.
That's the flash loan version. There's another version that takes weeks and leaves no spike on any chart. The two dominant oracle attacks exploit the same component in almost opposite ways, at opposite speeds, through opposite vulnerabilities.
Getting them confused is expensive. Several protocols have paid that tuition already.
One Block, One Billion: The Flash Loan Attack Anatomy
Flash loans are atomic: borrow, use, repay, all within a single Ethereum block. No collateral required, because the entire sequence either completes or reverts. That atomicity is the feature. It's also the weapon.
Here is how the oracle attack version works. Suppose a DeFi lending protocol prices its collateral by reading the spot price from a single on-chain AMM pool, specifically the ratio of the two tokens sitting in that pool at the moment of the query. An attacker takes out a flash loan of, say, 50 million USDC. They dump it into the pool, skewing the ratio violently. The oracle reads that skewed ratio and reports a wildly inflated price for the other token. The attacker immediately uses that inflated price to borrow far more than they should be allowed to borrow from the lending protocol, then repays the flash loan, the pool ratio snaps back, and the block closes. The lending protocol is now holding undercollateralized debt.
Twelve seconds. The price distortion never persists long enough for any off-chain monitoring system to catch it in time.
The oracle didn't malfunction in the traditional sense. It reported exactly what the pool contained at that moment. The pool was just lying.
The Compound and Cream Finance exploits that used this general pattern involved manipulating the price of thinly-traded tokens where a large capital injection could move the pool ratio dramatically. The thinner the pool, the cheaper the attack. A pool with $200,000 in liquidity is far easier to skew than one with $200 million, and that gap is not an abstraction: it is the difference between an attack that pencils out and one that doesn't.
Months of Patience: The Gradual Manipulation Playbook
Gradual manipulation is the slow-burn version, and it looks nothing like the flash loan attack at the execution layer.
The target here is usually a time-weighted average price oracle, or TWAP. Uniswap v2 and v3 both offer TWAP oracles that accumulate price data over a configurable window, often 30 minutes or several hours. The idea is that averaging prices over time makes them resistant to single-block spikes. Against flash loans, it works well. Against a patient adversary with capital, it is a different story entirely.
Imagine a protocol uses a 30-minute TWAP on a mid-cap token. An attacker who wants to inflate that TWAP needs to hold the spot price elevated for a meaningful portion of that window. They can't do it with borrowed capital that must be repaid in one block, so they use their own funds, buying continuously, absorbing sells, keeping the price above market for 20 or 25 minutes. The TWAP shifts upward. They then exploit the inflated reading exactly as the flash loan attacker would, borrowing against overvalued collateral.
The cost scales with pool depth and window length. A shallow pool with a short TWAP window is genuinely cheap to manipulate this way, and the math becomes unattractive only when the sustained capital commitment required starts to rival the potential gain.
Consider two depositors, Mara and Leon, who both entered the same lending protocol on the same day. Mara's collateral was a large-cap token priced by a Chainlink aggregator pulling from nine data sources, requiring six of them to agree within a 0.5% band before updating. Leon's collateral was a newer token priced by a single on-chain TWAP with a 10-minute window and $3 million in pool liquidity. When the protocol was exploited through Leon's collateral path, Mara's position was untouched. Leon's collateral was marked at three times its real value for just long enough. Same protocol, different oracle design, completely different exposure. The filing, as it were, was in the architecture all along.
Why the Fixes Don't Overlap Cleanly
TWAP oracles are specifically designed to neutralize flash loan attacks. They work: you cannot manipulate a 30-minute average with a 12-second transaction. But a TWAP is precisely what a gradual manipulator targets, because sustained price pressure is exactly what a TWAP measures and believes. It is like building a flood wall that doubles as a funnel.
Chainlink-style aggregators that pull from off-chain centralized exchange data solve the on-chain manipulation problem entirely, because the attacker can't affect Binance's order book by messing with a Uniswap pool. Those aggregators introduce a different trust surface, though: the node operators, the data sources, the update latency. They also can't list every long-tail token. A protocol built around exotic assets often has no Chainlink feed available at launch, which is not a hypothetical problem but a routine one.
Circuit breakers help with both, to a degree. Some protocols implement a check that refuses to accept any price that has moved more than X% since the last update, regardless of what the oracle reports. That catches the flash loan spike. A gradual manipulator who moves the price 2% per hour across twelve hours will sail right through a 5% circuit breaker, unimpeded.
The honest answer, and I think protocol teams owe their users this admission plainly stated in documentation, is that there is no single oracle design that is simultaneously manipulation-resistant at every timescale, decentralized, low-latency, and available for every asset. Protocol designers are picking their poison.
Liquidity Is the Real Variable
Here is what doesn't get enough attention: both attack types share one root condition. Thin liquidity.
A flash loan attack on a $500 million pool is not economically viable; the capital required to move the ratio far enough would itself exceed what you could steal. A gradual manipulation attack on a deep pool with a long TWAP window requires so much sustained buying pressure that the attacker's own position becomes the risk. In both cases, deep liquidity is the structural defense that makes the attack math go negative.
This is why the most dangerous moment for any protocol is at launch, when a new token's liquidity is shallow and the oracle window hasn't been stress-tested. The attack surface is widest precisely when the protocol is newest and most eager to attract deposits.
Have you actually found the oracle documentation for a protocol you use? If it lists multiple independent price sources with a minimum of three, a TWAP window of at least 30 minutes, and a price deviation circuit breaker, you're looking at a team that has done the homework. One source, short window, no breaker: that's a protocol that hasn't been attacked yet, not one that can't be. There is a meaningful legal and practical distinction between those two readings, and the market has historically been slow to make it.