In this thread, we attempt to further the discussion of a key problem in the oracle category and evolve our understanding of the space where research work has not yet answered the specific problem or question being considered.
With DeFi scaling to secure a growing amount of value in user deposited funds, it has increasingly become the subject of malicious entities attempting to subvert protocols for their own financial gain at the direct expense of innocent users. One of the most frequently exploited attack vectors targeted by malicious actors is the price oracle, which serves as a mechanism for valuing assets within a protocol. Without accurate price oracles that track the true market-wide price, DeFi protocols cannot safely execute critical functions like issuing loans at the fair market price, checking collateralization ratios, settling futures/options contracts, trading synthetic assets, and more.
As evidenced by the numerous recent oracle exploits in the DeFi space, it has become clear many DeFi protocols are still using oracle mechanisms that are vulnerable to manipulation and insufficient for securing high value contracts. The most common exploits have been caused by a lack of market coverage, where the oracle mechanism only pulls data from just one or a few exchanges, tracking only a small subsection of the total market. Without full market coverage (achieved by tracking all exchanges), these price oracles can become out of sync with the rest of the trading market and end up delivering inaccurate pricing data to DeFi applications that do not reflect the true market-wide price.
Such market coverage issues are exploited further through the use of flash loans, which are temporary on-chain loans that are issued and paid back within a single on-chain transaction, otherwise it reverts. This permissionless access to a large amount of capital can be used to execute large trades to distort the exchange rate of assets on a decentralized exchange (DEX) outside of the true market price across all other exchanges. Malicious actors can then use this mispricing to siphon funds from DeFi protocols using the manipulated DEX as its sole price oracle mechanism. Over the past few months, over $100M has been stolen from DeFi applications using price oracles without market coverage, often caused by the usage of a DEX-based oracle that had been flash loan attacked.
Additionally, such market coverage issues have also affected price oracles that fetch data from one or a small number of off-chain centralized exchanges, as they too can be manipulated to become out of sync with the rest of the trading market.
The natural question is, how can developers determine if an oracle mechanism provides market coverage and resistance to flash loan issues? Some questions to ask include:
Is the oracle only tracking one or a small number of exchanges?
Is data being collected from both on-chain and off-chain exchanges?
Does the oracle fetch directly from exchanges or from data aggregators?
How many individual data sources does the oracle pull from?
How is continuous market coverage ensured into the future?
With this context and relevant questions in mind, I am curious about others’ thoughts regarding the importance of market coverage and flash loan resistance in price oracle mechanism. What steps can be taken to ensure this knowledge can become more widely recognized in the DeFi development community to prevent oracle exploits happening again into the future?