Skip to content

The Mango Markets hack — $115M lost

Loss$115M
Date11 Oct 2022
ChainSolana
Failure classOracle manipulation
In assetsno bug — the code worked perfectly
Targetperpetuals exchange
1

What happened

The most uncomfortable entry on the list, because there is no vulnerable line to show you. The attacker funded two accounts, took both sides of a huge MNGO perpetual trade against himself, and pushed the mark price of a token with a few hundred thousand dollars of real depth up more than 1,000% in about twenty minutes. Mango's risk engine did exactly what it was written to do: it valued his position at the oracle price and let him borrow $115M against it. He then walked away and argued publicly that it was a legitimate trading strategy. The jury disagreed; a judge later overturned the conviction.

2

How the attack ran

  1. Fund two accountsAbout $5M on each side
  2. Trade MNGO-PERP against yourselfMark price +1,000% in roughly 20 minutes
  3. No cap on illiquid collateralThe risk engine values the position at the pumped mark
  4. Borrow against the pump$115M out; the code never malfunctioned
3

The code

the finding is the absence of a limit
// The risk engine, faithfully implemented:
collateral_value = position_size × oracle_price(MNGO)
                                    └── a token with ~$200k of real depth
                                        on a market the borrower can move himself

// ❌ What was missing was not a check — it was a limit:
    · no cap on how much of one account's collateral may be a single illiquid asset
    · no borrow cap scaled to the asset's real market depth
    · no confidence / deviation band on the oracle price
    · no time-weighting to make a 20-minute pump economically useless

→ the contract never malfunctioned. the economic model did.
4

What would have caught it

What an audit looks for: this entire class is invisible to a review that only reads code. You have to model the economics — for every asset you accept as collateral, ask what it costs an attacker to move its price far enough to break you. If that number is smaller than your TVL, you have a finding, no matter how clean the Solidity is.
6

Sources

Every figure on this page comes from the post-mortems above, not from us. Losses are US dollars at the time of the incident.

Check your own contract for this

Oracle manipulation is one of the 203 classes the SaferICO scanner checks for. It will not review your signing process — but it will read your Solidity.

Run the scanner See how it is attacked Read the docs