Skip to content

Single Oracle Source, No Fallback

SAFE-0204 Oracle / Price Checked automatically by the scanner
1

What goes wrong

Pricing depends on a single oracle with no secondary source or deviation cross-check. If that feed is deprecated, paused, or compromised, the protocol has no safe fallback and either bricks or prices on a bad number.

2

The vulnerable pattern

proof of concept — how it is exploited
// Chainlink deprecates the feed; latestRoundData reverts.
// with no fallback, every deposit/withdraw/liquidation reverts
// -> protocol frozen until an upgrade.
3

How to fix it

the pattern that is safe
uint256 p1 = chainlink.price();
uint256 p2 = fallbackOracle.price();
require(_within(p1, p2, MAX_DEVIATION), "oracle disagreement");
Use a primary + fallback oracle with a deviation check.
4

Where this has happened

Largest recorded losses in the same failure class — related, not the same bug:

Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0204 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs