Skip to content
critical Oracle / Price No SWC entry CWE-345

Flash-Loan Price Manipulation

SAFE-0023 Oracle / Price Checked automatically by the scanner
1

What goes wrong

Flash loans grant temporary capital with no collateral, letting an attacker manipulate any single-transaction-derived value (price, share ratio, vote weight) and profit before repaying in the same tx.

2

How to fix it

the pattern that is safe
// Defenses: TWAP oracles, snapshot-based voting, deposit/withdraw in same-block guards,
// and not trusting any value derivable from flash-borrowed capital.
bZx (2020). Design invariants to resist single-tx capital.
3

Where this has happened

Largest recorded losses in the same failure class — related, not the same bug:

Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0023 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs