Hack Analysis Nomad Bridge August 2022
A routine upgrade to Nomad's Replica contract set the zero hash as a trusted root, so any message whose hash was not yet in the messages mapping was treated as proven. An attacker could craft a message to unlock bridge funds, and because the exploit was replayable, others copied it and drained about $190m.
immunefi.com
Published on immunefi.com
The Nomad bridge was hacked on August 1st, 2022, and $190m of locked funds were drained. After one attacker first managed to exploit the vulnerability and struck gold, other dark forest travelers jumped to replay the exploit in what eventually became a colossal, “crowdsourced” hack.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the April 2022 upgrade initialised the trusted root to the zero hash, and because unset mapping entries also read as zero, any unseen message hash was accepted as proven.
What the attacker needed
None
How it was found
- Select an ERC-20 token and check the balance of the Nomad ERC-20 bridge contract.
- Generate a message payload with the attacker address as recipient and the full token balance as the amount.
- Call the vulnerable process function, which transfers tokens to the recipient address.
- Loop through various ERC-20 tokens with a relevant presence on the bridge’s balance to drain those funds in the same fashion.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A bridge is a smart contract that holds tokens locked on one blockchain so they can be used on another. Nomad's bridge checked whether a message had been approved by looking it up in a list; if the message was not in the list, the lookup returned zero, and the contract had been configured to trust zero. That meant anyone could invent a new message asking the bridge to send tokens to themselves, and the bridge would treat it as valid.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.