Skip to content
high Oracle / Price No SWC entry CWE-345

Stale / Unchecked Oracle Data

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

What goes wrong

Chainlink (or similar) responses are used without checking updatedAt freshness, round completeness, or non-positive answers, so a frozen or faulty feed feeds bad prices into the protocol.

2

How to fix it

the pattern that is safe
(uint80 rid, int256 p,, uint256 updatedAt, uint80 ansIn) = feed.latestRoundData();
require(p > 0, "bad price");
require(updatedAt != 0 && block.timestamp - updatedAt <= HEARTBEAT, "stale");
require(ansIn >= rid, "stale round");
uint256 price = uint256(p);
Always validate Chainlink round freshness and validity.
3

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-0024 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