In-depth lesson · Price oracle manipulation
Typical fixes
Every point the Price oracle manipulation reports back under this heading, best-backed first, each with the reports it is seen in.
-
Use a manipulation-resistant time-weighted average price or an external oracle instead of instantaneous pool reserves.
Seen in 6 reports
-
Require the oracle used for a loan to match the one the counterparty accepted, and reject oracle changes on outstanding loans.
Seen in 2 reports
-
Validate round completeness and a non-zero timestamp before consuming Chainlink round data.
Seen in 1 report
-
Scale by ten raised to the token's decimals, not by the decimal count itself.
Seen in 1 report
-
Average the price over the window rather than averaging pool balances, so a temporary imbalance does not dominate.
Seen in 1 report
-
Restrict who can update the oracle and allow more than one observation per epoch.
Seen in 1 report
-
Revert on TWAP failure instead of returning the spot price, and correct the inverted history condition.
-
Carry forward the accepted per-feed timestamps when rotating to a replacement oracle.
Seen in 1 report
-
Pass a non-zero minimum-shares-out to the router on strategy deposits.
-
Anchor the minimum output to an independent price source or add a circuit breaker instead of relying on an on-chain quoter.
-
Restrict the rebalance function so it cannot be called by anyone during a flash loan.
Seen in 1 report
-
Do not treat a permissionlessly reported value as the spot price for collateral valuation.
Seen in 1 report
-
Ensure the minimum lock period cannot be set to zero.