A time-weighted average price is computed over a very short window (a few blocks / seconds). On low-liquidity pools the average is still cheap to skew, so the TWAP inherits much of the spot price's manipulability.
// TWAP over 2 blocks. Attacker skews the pool, holds it high for those // 2 blocks (multi-block MEV / low competition), then borrows against the // inflated average before it decays.
// use a long, liquidity-appropriate window (e.g. >= 30 min) and a deep pool uint32 window = 1800; // 30 minutes price = consult(pool, window);
Largest recorded losses in the same failure class — related, not the same bug:
The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0201 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.