SC03:2026 - 価格オラクル操作 (Price Oracle Manipulation)

説明

Price oracle manipulation describes any situation where a smart contract relies on price or valuation data that can be directly or indirectly influenced by an attacker, causing the protocol to make decisions based on incorrect values. Oracles are trust boundaries: the contract implicitly trusts that the price it receives reflects real-world or on-chain market conditions. When that trust is violated—whether by manipulation, staleness, or misconfiguration—protocol behavior is distorted.

This affects all contract types that consume price data: DeFi lending and borrowing (collateral valuation, liquidation), AMMs and DEXes (spot and TWAP-based pricing), yield vaults (NAV calculations, share valuation), liquid staking and derivatives (ETH/stake price feeds), NFT and token valuations (floor price oracles), and cross-chain bridges (asset pricing for mint/burn ratios). On non-EVM chains (e.g., Move, Solana), similar patterns apply wherever external price sources feed into on-chain logic.

Few areas to focus on:

  • DEX-based oracles (spot price, TWAP, geometric mean) and resistance to flash loans, JIT liquidity, or concentrated liquidity skew

  • Off-chain and hybrid feeds (Chainlink, Pyth, custom relayers) and assumptions about freshness, deviation, and multi-source aggregation

  • Liquidity and market depth of the underlying price source (thin pools vs. deep markets)

  • Cross-chain and L2 pricing (finality delays, sequencer ordering, message relay assumptions)

Attackers exploit:

  • Spot price manipulation via large trades, flash loans, or JIT liquidity in the same block

  • TWAP manipulation over short windows or during low-liquidity periods

  • Stale or stuck data when contracts do not enforce freshness or fallback behavior

  • Deviation and outlier handling when aggregation logic fails to reject manipulated inputs

事例 (脆弱なオラクル使用)

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IPriceFeed {
    function latestAnswer() external view returns (int256);
}

contract VulnerableOracleLending {
    IPriceFeed public priceFeed; // single-point oracle
    mapping(address => uint256) public collateralEth;
    mapping(address => uint256) public debtUsd;

    constructor(IPriceFeed _feed) {
        priceFeed = _feed;
    }

    function depositCollateral() external payable {
        collateralEth[msg.sender] += msg.value;
    }

    function borrow(uint256 amountUsd) external {
        int256 price = priceFeed.latestAnswer(); // no sanity checks, no delay
        require(price > 0, "bad price");

        uint256 collateralUsd = (collateralEth[msg.sender] * uint256(price)) / 1e8;
        // Allows borrowing up to 100% of collateral value – overly generous
        require(collateralUsd >= amountUsd, "insufficient collateral");

        debtUsd[msg.sender] += amountUsd;
        // transfer stablecoin (omitted)
    }
}

Issues:

  • Single oracle source, no aggregation or sanity checks.

  • No upper/lower bounds or deviation checks against past values.

  • Economic parameters (100% LTV) make even minor manipulations profitable.

事例 (堅牢化したオラクル統合)

Security Improvements:

  • Uses a price feed interface with round metadata to reject stale or incomplete data.

  • Applies conservative collateral factors and explicit borrowing limits.

  • Encapsulates price fetch and validation in _getSafePrice, making reasoning and testing easier.

In 2025, pure oracle-only mega-exploits were less frequent, but oracle manipulation was often one component in multi-vector attacks.

2025 ケーススタディ

ベストプラクティスと緩和策

  • Aggregate multiple sources:

    • Use median/mean of several DEXs / oracles.

    • Reject outliers and anomalous deviations.

  • Time-based defenses:

    • Use TWAPs over sufficient windows to resist short-lived manipulations.

    • Reject prices older than a maximum staleness threshold.

  • Liquidity-aware design:

    • Avoid basing core prices on illiquid pools.

    • Cap impact of a single pool/feed on global pricing.

  • Fail-safe behavior:

    • On suspicious or unavailable data, halt sensitive operations (borrowing, liquidations).

    • Use circuit breakers and rate limiting on parameter changes.

  • Monitoring & alerting:

    • Track price deviations between your oracle and reference markets.

    • Set automated alerts for out-of-band movements or stuck oracles.

Last updated