Your loan does not watch the market. It watches the messenger that reports the market. In Web3 lending, that messenger is called a price oracle. When it speaks late, or speaks wrong, your collateral can be sold at a price you never saw on your screen. That gap is not a bug in one app. It is how on-chain lending has to work.
A smart contract cannot look anything up. It only knows what has been recorded on its blockchain. So when a lending protocol needs the dollar value of ETH or Bitcoin, someone has to deliver it. That delivery system is the oracle. Whatever number the oracle delivers, the contract treats as true. It follows its rules perfectly. It has no way to check if the note is current or correct.
This matters because almost everything that protects money in a loan runs on that one number. The protocol uses it to track the worth of assets deposited as collateral. It uses it to calculate the loan to value ratio. It uses it to assess whether a position meets minimum collateralization. It uses it to trigger liquidations. The same dependence shows up in stablecoins that use price data to manage collateral and in derivatives that settle against a market price.
Your position runs on oracle time
Here is the connection most borrowers miss. Lending apps show live market prices. Lending contracts do not act on live market prices. They act on the last oracle update. Those two clocks are often different.
Publishing a price on-chain costs a transaction. So no feed updates constantly. Instead, oracles use two triggers. A deviation threshold publishes when the price has moved more than a set percentage since the last update. A heartbeat publishes after a fixed interval regardless. Between updates, the protocol is using a stale figure.
Feeds typically update when the price moves by a set percentage or after a set amount of time passes, whichever comes first. This is not laziness. It is a cost trade off, and the parameters are published. A feed with a wide deviation threshold is cheap to operate and can be meaningfully behind during a fast move. A tight one is expensive and closer to real.
The practical result is simple. Liquidation runs on the oracle clock rather than the market clock. A position can appear safe on an exchange while already being liquidatable on-chain, or the reverse. The difference is a parameter you can look up before you borrow.
What the contract actually checks
To see why a delay can sell your collateral, it helps to see the check the contract makes. It compares the adjusted value of collateral with the value of debt. That comparison is often called the health factor. A position becomes eligible for liquidation when the health factor falls below the safe line.
Both sides of that check are oracle numbers multiplied by amounts held. Any error in the price moves the health factor in the same proportion. If the feed reports a collateral price that is too low, or a debt price that is too high, the protocol recalculates every position using that value. Positions near the limit drop below the liquidation threshold.
Automated liquidators watch for such positions. They repay part of the debt and take collateral at a discount. They react in seconds. By the time a team notices and fixes the feed, the collateral may already be sold. The liquidation engine then works exactly as programmed and still produces an unfair result.
A borrower who keeps a cautious buffer is less exposed, yet no buffer is unlimited. A large enough error can wipe out a normal safety margin, while a small one only hurts thin positions. That explains why damage in real incidents falls unevenly. The same wrong price takes the thinnest positions first.
A correct engine fed a wrong price still causes harm
An oracle price glitch happens when the price feed a lending protocol relies on reports a wrong value. The smart contract cannot tell, so it treats the recorded price as real. It lowers the value of the collateral. It can push a borrower health factor below the liquidation line even though the asset true market value never fell.
The borrower did nothing wrong, and the real market did not move. A glitch only needs a short window of wrong data, because liquidation bots react so fast. Not every such liquidation is automatically reversible or refunded.
The oracle price is the value used by the contract. It can differ from the price available across the wider market, because it may come from a limited set of sources, a smoothed formula or an exchange rate calculation. That gap is harmless when small and brief. It becomes dangerous when it is large enough to cross a liquidation threshold.
Why a feed would report a wrong price
There are two broad reasons. One is staleness. The feed has not updated yet. The other is sourcing. The feed derives its price from a market that does not reflect the wider market.
If a feed derives its price from a market, moving that market moves the feed. The cheapest version uses a venue with thin liquidity as the source. Someone with enough capital pushes the price on that venue, the oracle reports it, and a protocol acts on a figure that reflects the attacker trade rather than the market. Positions get liquidated, or the attacker borrows against collateral valued at a price they created.
Capital for such a push can be borrowed for a single transaction if the design permits. That detail matters. It means the attacker does not need to own the funds. They only need to control them for the moment the oracle reads the venue.
Making oracles safer also makes them slower
The defences are all about making the reported number harder to move. Aggregating across many venues means an attacker must move all of them. Using a volume weighted average over time means a momentary spike does not register. Requiring multiple independent reporters to agree removes any single compromised source.
Decentralized oracle networks follow this model. Instead of trusting one source, a network of independent node operators each collects prices from multiple exchanges and data providers. Their answers are combined into a single aggregated price, which is then posted on-chain. Because no single node controls the result, one bad actor or one faulty data source cannot easily distort it.
On-chain price oracles take a different path. Some protocols read prices directly from decentralized exchanges. The risk is that a single trade can move a pool price, so a raw spot price is easy to push around. To reduce this, many designs use a time weighted average price. A TWAP averages the price over a window of time, so a brief spike has little effect. An attacker would need to hold a distorted price for a long stretch, which costs far more.
Time weighted averaging is the most common on-chain defence, and it has a cost worth naming. An average over a window is by construction behind the market, so a design that resists manipulation is also a design that liquidates late. Resistance and responsiveness trade directly against each other, and there is no parameter that gives both.
The average price may exist nowhere
A feed that aggregates across venues is stronger, and it introduces a question about what happens when the venues disagree. During a genuine dislocation, prices diverge. An aggregate is then a number that exists nowhere. No venue is trading there, and a liquidator acting on it may be unable to execute at anything close.
That is how liquidations execute at prices that leave a shortfall even when the aggregate looked sufficient on paper. The protocol sold based on an average. The liquidator could only sell into real bids. If bids were lower on every real venue, the loan is left with bad debt.
Think of the sealed room that only takes notes through a window. Inside, the room is perfectly honest and keeps every rule. But it knows nothing about the world outside, unless someone outside writes it down and passes the note in. If three people outside shout different prices and the messenger writes down the middle, the room will act on a price no one will actually trade at.
What to check before you borrow
You cannot remove oracle risk. You can see it clearly and price it into your decisions. Start with these questions.
- Which oracle does the market use. Is it a decentralized network with many reporters, or a direct read from one exchange pool. A network feed resists single source faults. A single pool feed is easier to move.
- What are the update rules. Look for the deviation threshold and the heartbeat. A wide threshold means longer staleness in fast markets. That tells you the protocol clock may lag your screen by more.
- Is there averaging, and over what window. A time weighted average smooths spikes but lags turns. If the window is long, expect late liquidations in a crash and late releases in a recovery.
- How many sources feed the aggregate. More independent sources mean a harder target. But remember that an aggregate can mislead when sources split. Strength in normal times can still produce an untradable number in stress.
- How close is your health factor to the line. Since any price error moves the health factor in proportion, distance from the line is your only cushion against both staleness and glitches.
Lending protocols rely on oracles to monitor collateral values, calculate health factors, trigger liquidations, and protect solvency. Those jobs require precise price information. Yet precision here has two meanings. One is closeness to the market. The other is resistance to being moved. Every feed chooses between them.
Once you see that choice, liquidations that looked random start to make sense. A sale that triggered while your screen showed a safe price was not watching your screen. It was watching the last note passed through the window. If you want one loan, understood, start there. Ask what note your contract is reading, how old it can get, and how it was written. Then set your collateral buffer for that reality, not for the live ticker. For background, see CoinRadar Daily on oracle latency, Coingabbar on price glitches, The DeFi Path on how feeds work, and Gate Wiki on oracles and liquidation.
