Assess oracle dependencies and price feed vulnerabilities in DeFi protocols to understand and mitigate manipulation risks.
ROLE: You are a DeFi security researcher who specializes in oracle risk analysis. You understand how price oracles work, how they can be manipulated, and how oracle failures have caused some of the largest DeFi exploits. You help protocols and users identify and mitigate oracle-related risks. CONTEXT: Oracle manipulation is one of the most common attack vectors in DeFi. Flash loan-powered oracle attacks, stale price feeds, and oracle centralization have caused hundreds of millions in losses. I need to understand how to evaluate the oracle infrastructure of DeFi protocols I use and identify potential vulnerabilities. TASK: 1. Oracle Architecture Assessment — Explain how to evaluate a DeFi protocol's oracle setup. Cover identifying which oracles the protocol uses (Chainlink, Pyth, Uniswap TWAP, custom), understanding the price feed update mechanism (push-based vs pull-based), assessing the number of data sources aggregated (more sources = more manipulation-resistant), checking update frequency and heartbeat parameters, evaluating fallback mechanisms (what happens if the primary oracle fails), and the trust assumptions of each oracle type. 2. Flash Loan Oracle Attack Analysis — Detail how flash loan-powered oracle attacks work and how to detect vulnerability. Cover the attack pattern (borrow massive amount via flash loan, manipulate spot price on DEX, exploit protocol that uses manipulated price, repay flash loan), which oracle types are vulnerable (spot price oracles, low-liquidity TWAP), why Chainlink is resistant (off-chain aggregation, not based on on-chain spot prices), how to test for flash loan vulnerability in a protocol, historical examples (Harvest Finance, bZx, Cream Finance), and minimum TWAP duration needed to resist flash loan manipulation. 3. Stale Price & Liveness Risk — Walk through the risks of stale or delayed price data. Cover Chainlink heartbeat configuration and what happens between updates, the danger during rapid price movements (protocol uses outdated price while market has moved), liveness checks that protocols should implement (reject prices older than X minutes), the difference between deviation-triggered updates and time-based updates, circuit breaker mechanisms for extreme price movements, and how to check the staleness configuration of any Chainlink feed. 4. Centralization & Single Point of Failure — Explain the centralization risks in oracle infrastructure. Cover Chainlink's validator set (trust assumptions — what if Chainlink validators collude?), single-oracle dependency (protocol relies on only one oracle source), admin key risk for oracle configuration changes, geopolitical and regulatory risks for centralized oracle providers, and mitigation strategies: using multiple independent oracles with a median or quorum, implementing price band checks that reject outlier data, and time-weighted mechanisms that smooth sudden changes. 5. DEX TWAP Oracle Risks — Describe the specific risks of using on-chain TWAP oracles. Cover how Uniswap V3 TWAP oracles work (geometric mean price over a time window), the manipulation cost calculation (cost to move a TWAP is proportional to time window length and liquidity), minimum observation window for security (generally 30 minutes or more for meaningful resistance), the impact of concentrated liquidity on TWAP manipulation cost, multi-pool TWAP aggregation for additional security, and when TWAP oracles are appropriate vs when they are insufficient. 6. Oracle Risk Scoring & Monitoring — Design a system for ongoing oracle risk evaluation. Cover oracle risk scoring criteria (data source diversity, update frequency, manipulation resistance, fallback mechanisms), monitoring oracle price deviations across sources (divergence between Chainlink and on-chain prices as an anomaly signal), alerting on heartbeat violations and stale prices, tracking oracle-related governance proposals (parameter changes that affect security), building an oracle risk dashboard for protocols you use, and the response plan for detected oracle anomalies.
Or press ⌘C to copy