重访虫洞攻击

重访虫洞攻击

1. 背景

Wormhole,也称为爱因斯坦-罗森桥,是一种连接时空中不同点的推测性结构。在区块链世界中,Wormhole 被用作不同链(例如 SolanaEthereum)之间的桥梁。用户可以通过 Wormhole 在区块链之间转移代币化资产。

2022 年 2 月 2 日,Wormhole 遭到黑客攻击,攻击者成功铸造了价值 3.2 亿美元的 120,000 个封装以太坊,这是 DeFi 历史上继 Poly Network 之后的第二大损失。

2. Wormhole 如何工作

Wormhole 通过监控每条链上发出的消息来工作。监控到的消息将被转发到目标链,以便构建跨链通信协议。

直观的问题是如何保证监控到的消息是可信的。为了解决这个问题,Wormhole 引入了 19 个额外的节点,称为守护者。当前守护者集合可以在 Wormhole Explorer 中查看。每个守护者都可以独立验证监控到的消息并对其进行签名。

在 Wormhole 中,消息以 VAA 格式组织。VAA 由两部分组成。一部分是头部,收集守护者的签名。另一部分是主体,包含目标链信息、消息负载等。

一旦守护者的签名达到共识阈值,VAA 就可以被发布到链上。

总而言之,守护者负责传输消息的完整性。

3. 代币桥

在介绍了消息如何在不同链之间传输后,就不难理解代币桥(Wormhole 的主要应用)是如何工作的了。

要将代币从链 A 转移到链 B。Wormhole 会在链 A 上锁定代币,并在链 B 上铸造。这是高层思路。实际上,这可以分为三个步骤。首先,链 A 上的代币被锁定。其次,广播将链 A 上的代币转移到链 B 的消息。第三,链 B 接收消息,并铸造相应的代币。一切就绪。

4. Solana 指南

在 Solana 中,一个交易由多个指令组成。每个指令包含一个程序 ID、账户和数据。程序 ID 代表将处理该指令的程序(智能合约)。程序将解释数据并操作提供的账户。

5. Wormhole 攻击

简而言之,攻击者在 Solana 上铸造了 120,000 个 ETH,而没有在以太坊上锁定任何资产。交易在此

因此,问题是如何使攻击者能够在 Solana 上铸造 120,000 个 ETH。让我们详细说明步骤。要铸造代币,会调用指令 complete_wrapped。此指令接收多个地址,其中第三个是存储签名消息的地址。在铸造 120,000 个 ETH 之前,链 B(即 Solana)应该收到指示已在链 A(即以太坊)上锁定 120,000 个 ETH 的签名消息(即 VAA)。

要发布消息,会调用 post_vaa.rs 中定义的 post_vaa。因此,将创建一个账户来存储消息。但是,post_vaa 不会检查守护者的签名。相反,verify_signatures.rs 中定义的 verify_signaures 会验证签名。

馈送到 verify_signatures第四个账户是系统指令账户。现在让我们探讨 verify_signatures 如何工作。

第 103 行,调用 load_instruction_at 函数来加载先前执行的指令 secp_ixsecp_ix 将调用 Secp256k1 签名验证函数。因此,verify_signatures 通过检查先前执行的指令 secp_ix 来验证签名。现在你弄清楚一切了吗? load_instruction_at 函数不会检查从哪里加载指令!!!你只需要从 Sysvar:Instructions 加载指令。

然而,攻击交易的第四个账户是 2tHS1cXX2h1KBEaadprqELJ6sV9wLoaSdX68FqsrrZRd,而不是 Sysvar:Instructions。在这种情况下,攻击者成功绕过了签名验证过程。Wormhole 认为验证已通过,消息已发布到链上,导致在未锁定任何资产的情况下铸造了 120,000 个 ETH!

让我们看看一个合法的验证指令。此交易包含两个指令。第一个调用 Secp256k1 验证函数,第二个调用 verify_signatures 指令。请注意,这里的第四个账户是 Sysvar:Instructions。

铸造 120,000 个 ETH 后,攻击者能够将其提取回以太坊并兑换成其他代币以获利。

6. 补丁

存储库所述,从 1.8.0 版本开始,load_instruction_at 不安全,并且不会检查 Sysvar 账户地址。因此,推荐使用 load_instruction_at_checked

7. 我们的思考

  • 开发人员应非常熟悉他们使用的外部函数。
  • 持续关注已使用库的任何重要更改。如果库发生更改,使用该库的代码可能需要更改。
  • 库维护者应意识到特定更改的潜在风险,并及时通知整个社区。仅仅添加注释可能不起作用,而且不够。
  • 如果库和代码的版本发生变化,您的合约代码需要进行审计。

关于 BlockSec

BlockSec 是一家开创性的区块链安全公司,由一群全球知名的安全专家于 2021 年创立。公司致力于提升新兴 Web3 世界的安全性和可用性,以促进其大规模采用。为此,BlockSec 提供智能合约和 EVM 链安全审计服务、用于安全开发和主动阻止威胁的Phalcon平台、用于资金追踪和调查的MetaSleuth平台,以及供 Web3 构建者在加密世界高效冲浪的MetaSuites扩展。

迄今为止,该公司已为 MetaMask、Uniswap Foundation、Compound、Forta 和 PancakeSwap 等 300 多家尊贵客户提供服务,并从 Matrix Partners、Vitalbridge Capital 和 Fenbushi Capital 等杰出投资者那里获得了两轮融资,总计数千万美元。

官方网站:https://blocksec.com/

官方 Twitter 账号:https://twitter.com/BlockSecTeam

Sign up for the latest updates
Weekly Web3 Security Incident Roundup | Feb 9 – Feb 15, 2026

Weekly Web3 Security Incident Roundup | Feb 9 – Feb 15, 2026

During the week of February 9 to February 15, 2026, three blockchain security incidents were reported with total losses of ~$657K. All incidents occurred on the BNB Smart Chain and involved flawed business logic in DeFi token contracts. The primary causes included an unchecked balance withdrawal from an intermediary contract that allowed donation-based inflation of a liquidity addition targeted by a sandwich attack, a post-swap deflationary clawback that returned sold tokens to the caller while draining pool reserves to create a repeatable price-manipulation primitive, and a token transfer override that burned tokens directly from a Uniswap V2 pair's balance and force-synced reserves within the same transaction to artificially inflate the token price.

Top 10 "Awesome" Security Incidents in 2025

Top 10 "Awesome" Security Incidents in 2025

To help the community learn from what happened, BlockSec selected ten incidents that stood out most this year. These cases were chosen not only for the scale of loss, but also for the distinct techniques involved, the unexpected twists in execution, and the new or underexplored attack surfaces they revealed.

#10 Panoptic Incident: XOR Linearity Breaks the Position Fingerprint Scheme

#10 Panoptic Incident: XOR Linearity Breaks the Position Fingerprint Scheme

On August 29, 2025, Panoptic disclosed a Cantina bounty finding and confirmed that, with support from Cantina and Seal911, it executed a rescue operation on August 25 to secure roughly $400K in funds. The issue stemmed from a flaw in Panoptic’s position fingerprint calculation algorithm, which could have enabled incorrect position identification and downstream fund risk.