Toutes les vulnérabilités
CRITICALWeb3exploited in the wildcurated

WEB3-NOMAD-2022

Web3 · Ethereum · Nomad

Résumé

On August 1, 2022, the Nomad token bridge was drained of roughly $190 million in a few chaotic hours, and it became the first large crypto theft to turn into an open, crowdsourced free for all. Nomad processed cross chain messages in two steps: prove (record a message under a confirmed Merkle root) then process (execute it). A contract upgrade initialized the Replica contract with a committed root of bytes32(0), the empty tree root, and the initializer wrote confirmAt[bytes32(0)] = 1, permanently marking the zero root as trusted. Because any unproven message hash reads back the Solidity default of bytes32(0), the validity check acceptableRoot(0x00) returned true for every message that was never proven. Attackers skipped prove() entirely and called process() with crafted calldata, releasing funds with no Merkle proof at all. After the first transaction, anyone could copy it, swap in their own address and rebroadcast, so hundreds of opportunists piled in. Bridge TVL fell from about $190.7 million to under $2,000, and only roughly $36 to $39 million (about a fifth) was ever returned.

Comment le corriger

  • Reject bytes32(0) and any default or sentinel value in acceptableRoot(); add an explicit require(_root != bytes32(0)) before trusting a root.
  • Guard the initializer so it requires a non-zero committed root before writing confirmAt, and disable initializers on implementation contracts.
  • Authorize in process() only on a genuine proven state, never on a value (0x00) that an unset mapping also returns by default.
  • Diff deployed bytecode against the exact audited commit and block any deploy that does not match.
  • Re-run the full invariant suite after every upgrade: no message processes unless genuinely proven, and bytes32(0) is never an acceptable root.

Comment l’éviter dans votre code

  • Never overload bytes32(0) as both the mapping default and a valid sentinel; keep the unproven and valid-root domains disjoint.
  • Treat any "zero or empty value treated as valid" audit finding as potentially critical regardless of its initial severity rating, and require the auditor to sign off on the fix rather than closing it unilaterally.
  • Use initializer modifiers and validate that every init parameter rejects zero.
  • Fuzz and property-test proof verification against empty, absent and malformed proofs; require a positive proof record, not merely a non-revert.
  • Treat audited-versus-deployed drift as a release blocker.

Détails de l’avis

How it happened

The fatal line entered the codebase on May 26, 2022, inside a commit ironically titled as a fix, committed while Quantstamp's audit was already underway. The refactor changed the messages mapping from a status enum to a bytes32 root and rewired process() to gate on acceptableRoot(messages[hash]) instead of an explicit "Proven" check. The dangerous configuration went live on June 21, 2022 (Ethereum block 15,002,481), when the Replica was upgraded and initialized with all parameters set to zero. For roughly forty days nothing happened, then on August 1 the first fraudulent process() call walked out with 100 WBTC (about $2.3 million) using no proof at all. The exploit needed no skill to copy: as Paradigm's samczsun put it, you only had to find a transaction that worked, replace the other person's address with yours, and rebroadcast it. Google's Mandiant later counted 532 addresses that each took more than $1,000, and Coinbase found that copycats (around 88 percent of the participating addresses) accounted for about $88 million of the haul. It was less a heist than a bridge smart-contract flaw turned into a public ATM.

What the audit missed and what followed

Nomad was audited. Quantstamp's report even contained a finding, "Proving With An Empty Leaf," in the same zero-or-empty-value class, rated Low Risk; Nomad dismissed it as effectively impossible to exploit, and Quantstamp replied that the team had misunderstood the issue. The finding sat on a sibling code path (prove(), not the init plus process() path actually abused), but the lesson is exact: a low-severity "empty is treated as valid" note foreshadowed a nine-figure loss. Zellic later showed the deployed Replica diverged sharply from the audited code, a textbook case of audit drift, though Nomad disputes the framing. Recovery ran through an official wallet operated with Anchorage Digital, with a standing offer to treat anyone returning at least 90 percent as a white hat; about $36 to $39 million came back. The original exploiter was anonymous and the crowd was permissionless, so most participants were never identified. One suspect, Alexander Gurevich, was charged in a 2023 US indictment and arrested in Israel in 2025; he is described as the first to trigger the bug but neither its author nor its largest beneficiary. Unlike Ronin and Harmony, there is no North Korea attribution here. Nomad relaunched a gated, KYC-restricted bridge in December 2022. It capped the worst year on record for bridges: Chainalysis tallied roughly $2 billion stolen across 13 cross-chain bridge hacks in 2022, alongside Wormhole, Ronin, Poly Network and the BNB Chain token hub.

Références

Vulnérabilités liées

Tout Web3 →