Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Oracle Security Module (OSM)

A smart contract component that imposes a time delay on new price feed updates, allowing protocol governance to intervene if a malicious or erroneous price is detected.
Chainscore © 2026
definition
BLOCKCHAIN SECURITY

What is Oracle Security Module (OSM)?

A security mechanism for decentralized oracle networks that introduces a one-block delay for price updates to protect DeFi protocols from flash loan attacks and oracle manipulation.

The Oracle Security Module (OSM) is a smart contract component, pioneered by MakerDAO for its Maker Protocol, designed to protect decentralized finance (DeFi) applications from price oracle manipulation and flash loan attacks. It functions by introducing a mandatory, one-block delay between when an oracle observes a new price and when that price becomes available for on-chain consumption by other smart contracts. This delay provides a critical security window, allowing protocol guardians or automated systems to react to and potentially invalidate malicious or erroneous price data before it can be used to trigger liquidations or mint excessive debt.

The core mechanism works by having the OSM act as an intermediary. The primary oracle (e.g., a set of Maker Oracle relayers) pushes the latest price feed to the OSM contract. This price is stored but remains inactive for a predefined period, typically one Ethereum block (approximately 12 seconds). After this delay elapses, the price becomes active and is then readable by the main protocol contracts, such as Maker's Vault system. This simple yet effective design prevents an attacker from using a single block to both manipulate an oracle price and exploit it, as the manipulated price would not be usable until the subsequent block.

The OSM's security model is particularly effective against flash loan-based attacks, where an attacker borrows a large sum of capital within one transaction to artificially move a market price on a decentralized exchange (DEX). Without an OSM, a compromised oracle could immediately report this manipulated price, allowing the attacker to drain a protocol. With the OSM, the manipulated price is delayed, giving the protocol or its community time to detect the anomaly through monitoring tools and execute an emergency shutdown or other defensive measures before the bad data is applied.

While highly effective, the OSM introduces a trade-off between security and latency. The one-block delay means that protocols using it are not operating on the absolute latest price data, which can be a consideration during periods of extreme market volatility. Consequently, the OSM is often used to protect critical, high-value financial functions like collateral valuation for stablecoin systems, where security is paramount. Its design has influenced broader oracle security practices, emphasizing that oracle data should be treated as an untrusted input that requires validation or a cooling-off period.

key-features
ORACLE SECURITY MODULE

Key Features of the OSM

The Oracle Security Module (OSM) is a core smart contract in the Maker Protocol that introduces a one-hour delay for new price data, providing a critical security buffer against oracle manipulation and flash loan attacks.

01

Price Delay Mechanism

The OSM's primary function is to delay the publication of new price data from its source oracle (e.g., a Medianizer) for a fixed period, typically one hour. This creates a time-locked price feed where the current on-chain price is always the price from one hour ago. This delay provides a predictable window for the system to react to malicious price updates before they take effect.

02

Flash Loan Attack Mitigation

The delay is a direct defense against flash loan-based oracle manipulation. In a typical attack, a malicious actor could borrow vast sums, manipulate a spot price, trigger liquidations or mint excessive debt, and repay the loan—all within a single transaction. The OSM's delay makes this impossible, as the manipulated price would not be available on-chain until long after the transaction concludes.

03

Governance-Controlled Parameters

Key OSM parameters are managed by Maker Governance through executive votes. This includes:

  • Delay duration: The length of the price delay (e.g., 1 hour).
  • Source oracle: The address of the feed provider (e.g., the Medianizer contract).
  • Authorized readers: Which contracts (like Vaults and Liquidators) are permitted to read the delayed price. This ensures centralized, democratic control over a critical security component.
04

peek() vs. read() Functions

The OSM exposes two primary view functions with different security levels:

  • peek(): Returns the future price (the most recent raw feed data) and a validity boolean. This is used for system monitoring and off-chain analysis.
  • read(): Returns the current, time-delayed price that is safe for use within the protocol. Only contracts explicitly authorized by governance (like the Vat core accounting contract) can call read(), enforcing the security boundary.
05

Integration with the Maker Core

The OSM does not hold collateral or manage debt directly. It is a peripheral contract that feeds data into the core Vat system. When a liquidation engine or vault needs a price, it calls the OSM's read() function. This architectural separation follows the principle of least privilege, isolating the oracle security logic from the core monetary functions of the protocol.

06

Security vs. Latency Trade-off

The one-hour delay represents a calculated trade-off between security and price freshness. While it provides robust protection, it means the protocol operates on slightly stale data. This design assumes that the market cannot be reliably manipulated for a full hour without the price correcting. It is a deliberate, conservative security choice suited for a decentralized stablecoin backbone, prioritizing system integrity over ultra-low latency.

how-it-works
MECHANISM

How the Oracle Security Module Works

A technical breakdown of the Oracle Security Module (OSM), a smart contract component designed to introduce a time delay on oracle price updates to protect DeFi protocols from flash loan attacks and price manipulation.

The Oracle Security Module (OSM) is a smart contract mechanism, pioneered by MakerDAO, that imposes a mandatory time delay (e.g., one hour) on fresh price data from an oracle before it can be used by a protocol's core contracts. This delay creates a critical defensive buffer. When a new price is reported by the oracle's relayers, it is stored in the OSM but remains unavailable for the duration of the delay. Only after this period elapses does the price become the new oracle price for the system, a process known as the price "going live." This design fundamentally prevents an attacker from using the same price update within a single transaction to manipulate the system.

The core security benefit is the mitigation of flash loan attacks and other forms of price oracle manipulation. In a typical attack, a malicious actor borrows a vast sum via a flash loan, manipulates an asset's price on a decentralized exchange (DEX), and then exploits that manipulated price in a lending protocol to drain funds—all within one block. The OSM renders this impossible because the attacker cannot access the new, potentially manipulated price until the delay period has passed, by which time the flash loan must be repaid and the attack window has closed. The system continues to operate using the previous, validated price during the delay.

From a technical perspective, the OSM acts as a proxy or cache between the oracle's core reporting contract (like the Medianizer in MakerDAO) and the consumer contracts (like the Vault or CDP system). It exposes two key price views: peek(), which returns the current live price and a bool indicating stability, and peekNext(), which reveals the pending price waiting in the delay queue. This transparency allows users and external systems to see both the current state and the impending change, enabling informed decisions. The delay duration is a governance-set parameter, allowing the protocol community to balance security with market responsiveness.

While highly effective against intra-block exploits, the OSM introduces a trade-off: price latency. During periods of extreme market volatility, the protocol's internal price lags behind real-time market prices by the delay period. This can affect liquidation efficiency and collateralization ratios. To manage this, protocols often implement circuit breakers or global settlement mechanisms as a backstop. The OSM is a foundational defense-in-depth layer, often used in conjunction with other oracle security practices like using multiple data sources, time-weighted average prices (TWAPs), and robust relay networks.

primary-use-case
PRIMARY USE CASE: MAKER PROTOCOL

Oracle Security Module (OSM)

The Oracle Security Module (OSM) is a core smart contract in the Maker Protocol that introduces a one-hour delay on new price data from oracles before it can be used to liquidate vaults, providing a critical defense mechanism against flash loan attacks and oracle manipulation.

01

How the OSM Works

The OSM acts as a time-delayed buffer between the Maker Protocol's oracle relays and its core smart contracts. It stores the latest price feed but only releases the medianized price from one hour ago to the system. This creates a mandatory delay window where the price used for critical actions like liquidations is already public and immutable on-chain, preventing attackers from exploiting new price data instantly.

02

Defense Against Flash Loan Attacks

The primary security function is to neutralize flash loan-based oracle manipulation. In a typical attack, an attacker uses a flash loan to dramatically move a market price, triggering unfair liquidations. With the OSM, the price used by the system is one hour stale, making it impossible for an attacker to both manipulate the current price and have that new price affect the protocol within a single transaction block.

03

OSM vs. Direct Oracle Feed

This contrasts with a direct oracle feed, where the latest price is used immediately.

  • Direct Feed: Vulnerable to instantaneous price spikes and MEV (Maximal Extractable Value) extraction.
  • OSM (Delayed Feed): Uses a historical, verifiable price, sacrificing some immediacy for byzantine fault tolerance. Vault users can see the pending price change with full transparency and have one hour to react by adding collateral or repaying debt.
04

Interaction with Liquidations 2.0

The OSM is integrated with Maker's Liquidations 2.0 (Dog and Clip) system. The delayed price from the OSM determines the collateral auction kick price. This ensures auction start prices are based on stable, historical data, not a momentarily manipulated market. Keepers monitoring the system can see the future price and prepare for liquidations predictably, improving market efficiency.

05

Transparency & User Safeguards

The OSM provides complete transparency. The peek() function shows the current, delayed price in effect, while the peep() function shows the future price that will become active after the delay. This gives vault owners a one-hour grace period to take corrective action if the future price might put their position at risk, acting as a final automated warning system.

06

Technical Implementation

Implemented as a smart contract that is fed by the Medianizer from Maker's oracle network. It uses a simple queue-like storage for price data, with a new price poke()ed in every hour. The system's security guarantee relies on the assumption that an attacker cannot manipulate an oracle price and sustain that manipulation on external markets for over an hour, which is economically prohibitive.

security-considerations
ORACLE SECURITY MODULE (OSM)

Security Considerations and Trade-offs

The Oracle Security Module (OSM) is a core security mechanism in MakerDAO's decentralized oracle system, designed to protect the protocol from malicious or erroneous price feed data by introducing a mandatory delay.

01

Core Mechanism: The Price Delay

The OSM's primary function is to enforce a one-hour delay (configurable per collateral type) between when a new price is reported by the oracle and when it becomes available for use by the Maker Protocol. This creates a critical security buffer, allowing time for the community to detect and react to potentially harmful price data before it impacts the system's collateralization ratios and triggers liquidations.

02

Primary Security Benefit: Front-Running Protection

The delay is a direct defense against oracle manipulation attacks and flash loan exploits. Without an OSM, an attacker could theoretically manipulate a spot price, instantly drain a protocol via undercollateralized loans, and exit before the market corrects. The one-hour window makes such attacks economically unfeasible, as the manipulated price would be visible to all, allowing for emergency shutdown or other defensive governance actions.

03

Key Trade-off: Latency vs. Security

The OSM introduces a fundamental trade-off between price freshness and security. While it prevents instant manipulation, it also means the protocol operates on slightly stale data. This can be problematic during periods of extreme market volatility, where a one-hour-old price may not accurately reflect current market conditions, potentially leading to delayed liquidations or suboptimal keeper incentives.

04

Architectural Role: OSM vs. Medianizer

The OSM works in tandem with the Oracle Medianizer (or OSM). The process is:

  • Medianizer: Aggregates price data from multiple oracle relayers to produce a single canonical price.
  • OSM: Takes this canonical price as input, stores it, and only releases it to the core Vat contract after the delay has elapsed. This separation of concerns ensures the delay logic is isolated and auditable.
05

Governance and Parameterization

The OSM's delay parameter is not static; it is a governance-controlled variable. The MakerDAO governance community can vote to adjust the delay (e.g., osm.wait) for specific collateral assets based on their liquidity, volatility, and perceived risk. This allows the system to optimize the security-latency trade-off on a per-asset basis.

06

Limitations and Complementary Measures

The OSM is not a complete oracle security solution. Its effectiveness relies on other components:

  • Robust Oracle Feeds: A diverse set of high-quality data sources is still required.
  • Emergency Shutdown (ES): The ultimate circuit-breaker if malicious data passes the OSM.
  • Circuit Breaker Modules: Some protocols implement additional logic that can freeze oracles if price deviations exceed certain thresholds within the delay window.
SECURITY ARCHITECTURES

Comparison with Other Oracle Security Mechanisms

How the OSM's delayed price feed update mechanism compares to alternative approaches for securing on-chain oracle data.

Security FeatureOracle Security Module (OSM)Multi-Signer CommitteeThreshold Signature Schemes

Primary Security Mechanism

Time-delayed price feed with governance activation

M-of-N signature aggregation

Cryptographic threshold signatures (e.g., FROST)

Latency to Final Value

Governance delay (e.g., 1-2 hours)

Committee consensus latency (< 1 sec)

Signature aggregation latency (< 1 sec)

Attack Surface for Live Feed

Zero (feed is static during delay)

Committee members' keys

Distributed key generation (DKG) ceremony

Response to Compromised Data

Governance can reject bad data before activation

Relies on honest majority of committee

Relies on honest majority of signers

Decentralization Assumption

Governance security (e.g., MKR holders)

Committee honesty and liveness

Signer set honesty and liveness

Gas Cost for Update

Low (single storage write)

High (multiple signature verifications)

Moderate (single aggregated signature verification)

Trust Minimization

High (explicit governance checkpoint)

Medium (trust in committee selection)

Medium (trust in DKG and signer set)

ORACLE SECURITY MODULE

Frequently Asked Questions (FAQ)

The Oracle Security Module (OSM) is a critical smart contract component designed to protect DeFi protocols from price manipulation by introducing a one-hour delay on oracle price updates. This FAQ covers its core mechanics, security benefits, and implementation details.

An Oracle Security Module (OSM) is a smart contract that introduces a configurable time delay, typically one hour, between receiving a new price feed from an oracle and making it available to a protocol's core contracts. It works by having the oracle (e.g., a MakerDAO Medianizer or DS-Value) post new price data to the OSM instead of directly to the system. The OSM stores this data for the duration of the delay period. After the delay elapses, the OSM's peek() function returns the new, valid price, while its peep() function returns the older, still-active price. This creates a time-locked price feed that gives the protocol a one-hour window to react to potential oracle manipulation or flash loan attacks before the new price affects liquidations, borrowing limits, or other critical functions.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Oracle Security Module (OSM) - Definition & Use in DeFi | ChainScore Glossary