# Flash-loan oracle manipulation

Pricing, sizing or rewards read from pool balances or spot state a flash loan can move in one transaction

_Area: DeFi oracles, liquidations and flash loans. Seen in 6 disclosed reports; one confirmed bounty: $800,000; latest 2025-03-04. Updated 2026-10-24._

## How it works
A contract prices an asset, sizes a deposit, or computes a reward from state that lives in a pool (reserves, balances, spot price) rather than from a manipulation-resistant source. A flash loan supplies enough capital to skew that state within one transaction, the protocol then acts on the skewed value, and the attacker unwinds the loan. The broken assumption is that pool state observed at call time reflects a fair price; it only reflects the last trade, which the caller controls.

## Where it shows up
- `addLiquidity`/swap calls that pass the pool's current price with 100% slippage tolerance [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-fei-protocol-flashloan-vulnerability-bugfix-review.md)
- `buyToken`/sell paths with no slippage parameter at all [E3](https://bugbountylibrary.com/r/dhl%3A20250304-pump.md)
- Deviation or slippage checks placed before an arbitrary external call (router swap, token hook) and never re-checked [E2](https://bugbountylibrary.com/r/sherlock%3A2023-06-arrakis%3AH-1.md)
- Interest/reward math derived from token balances or prices the caller can move [E4](https://bugbountylibrary.com/r/dhl%3A20231211-goodcompound.md)
- Permissionless functions that move protocol funds at a market-derived rate [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-fei-protocol-flashloan-vulnerability-bugfix-review.md)

## How to review
Identify every value used for pricing, sizing, or reward and trace where it comes from. The invariant: no fund-moving decision may depend on state a caller can change earlier in the same transaction. Check that slippage/deviation bounds are enforced at the moment of the state-changing call, not before an intervening external call [E2](https://bugbountylibrary.com/r/sherlock%3A2023-06-arrakis%3AH-1.md). For E1, note that the `extcodesize`-based `nonContract` guard was bypassable from a constructor; this is a guard-bypass enabler, not the oracle root cause, and should be reviewed separately.

## Variants seen
- Deposit at oracle price with 100% slippage into a flash-distorted pool, with a constructor bypass of the contract guard as an enabler [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-fei-protocol-flashloan-vulnerability-bugfix-review.md)
- Deviation check before an attacker-controlled token callback that moves price before liquidity is added [E2](https://bugbountylibrary.com/r/sherlock%3A2023-06-arrakis%3AH-1.md)
- Missing slippage in `buyToken` allowing reserve skew then profitable sell [E3](https://bugbountylibrary.com/r/dhl%3A20250304-pump.md)
- Interest collection computed from manipulable balances; root cause unconfirmed, duplicate market entries not established as a factor [E4](https://bugbountylibrary.com/r/dhl%3A20231211-goodcompound.md)

## Impact and severity
Ranged from ~$6.4K [E3](https://bugbountylibrary.com/r/dhl%3A20250304-pump.md) and ~$13K [E4](https://bugbountylibrary.com/r/dhl%3A20231211-goodcompound.md) to up to 60,000 ETH of potential exposure [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-fei-protocol-flashloan-vulnerability-bugfix-review.md). Severity rises with the size of protocol-owned funds exposed and with permissionless entry points; missing slippage bounds and checks ordered before external calls made it worse.

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-fei-protocol-flashloan-vulnerability-bugfix-review.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2023-06-arrakis%3AH-1.md
- E3: https://bugbountylibrary.com/r/dhl%3A20250304-pump.md
- E4: https://bugbountylibrary.com/r/dhl%3A20231211-goodcompound.md
