The system was designed to be trustless. On February 2, 2022, the Wormhole bridge processing a cross-chain message lost 120,000 wETH — approximately $320 million at the time. The root cause? A single unchecked loop in the signature verification contract.
Code is law, until it isn't.
The Wormhole bridge connects Solana to other chains via a Guardian network. Guardians observe events on one chain and sign Verifiable Action Approvals (VAAs). A VAA contains the payload and at least 13 of 19 Guardian signatures to be considered valid. The flaw was in the Solana side of the contract: the function verify_signatures incorrectly assumed that if the Guardian set provided a valid signature for one position, all subsequent positions could be skipped.
I have audited cross-chain bridge implementations since 2020. This is a classic case of optimistic verification — the code trusted that the input would not be maliciously crafted. The attacker passed a specially crafted guardian_set where the first signature was valid, then set the guardian_set.active flag to zero after that signature. The verification loop terminated early, returning true for an invalid set. The bridge then released the tokens.
Let me walk through the pseudocode equivalent of the vulnerable function: