How Can a DeFi Protocol Detect and Prevent a Flash Loan-Induced Price Manipulation Attempt?

Protocols can implement checks that reject transactions where the price change between the current block and the previous block exceeds a certain threshold. They can also use "pre-flight checks" within the transaction to ensure the loan is repaid and the price is not drastically different at the end.

Utilizing TWAP oracles is the most robust preventative measure against single-block price spikes.

Can a Deviation Threshold Be Bypassed by a Flash Loan Attack?
Can a Flash Loan Be Used to Attack an Oracle That Relies on a TWAP?
What Is the Role of Time-Weighted Average Price (TWAP) in DeFi Oracles?
What Is a “Flash Loan” and How Is It Used in Conjunction with Oracle Manipulation?
What Is “Order Book Stuffing” and How Can It Be Used to Intentionally Mislead Iceberg Detection Algorithms?
What Is the Difference between an Exchange’s “Front-Running” Detection and Manipulation Monitoring?
How Does a DEX Determine the Optimal Price Deviation Threshold for a “Push” Update?
What Is Time-Weighted Average Price (TWAP) and How Does It Defend against Flash Loan Attacks on Oracles?

Glossar