通过主动威胁预防确保 Web3 安全

通过主动威胁预防确保 Web3 安全

引言

在过去三年中,我们观察到 DeFi 生态系统中发生了多起安全事件。为了应对威胁,社区采用了以代码为中心的方法,例如静态代码审计、智能合约扫描工具或动态模糊测试。尽管这些方法已显示出有效性,但我们认为以代码为中心的方法不能单独解决安全问题和保护用户资产。例如,存在多个案例,易受攻击的合约已通过多家信誉良好的代码审计公司进行审计

我们相信,除了现有的以代码为中心的方法之外,还应该存在更主动的威胁防护解决方案来抵御威胁。我们在 2021 年底内部讨论了这一想法,并于 2022 年初开发了一个名为 IronDome 的系统。自那时以来,我们已在 BlockSec 内部部署了该系统。在 2022 年,IronDome 成功阻止了多次攻击,并为用户挽回了超过 500 万美元的资产,其中包括 2022 年 4 月阻止 Saddle Finance 被利用的案例,挽回了 380 万美元。

在本博客中,我们将详细介绍 IronDome 的系统架构及其成功案例。我们还将讨论我们系统的局限性以及对未来威胁防护方向的见解。

高层系统架构

IronDome 的基本思想是监听以太坊的待处理交易池,通过我们的 交易预执行系统 Mopsus 检测攻击交易,并通过自动合成一个救援交易来阻止攻击,该交易会将易受攻击的资产转移到我们的安全账户,并利用 FlashBot 在攻击交易之前执行。下图展示了该架构。

系统架构概述
系统架构概述

内存池监控

IronDome 通过我们定制的 Geth 客户端监听内存池中的待处理交易。关键在于我们的系统应及时监听交易,并尽可能多地监听交易。

攻击检测

每个待处理交易都将被馈送到攻击检测模块。由于这些交易尚未上链,我们将利用我们的交易预执行引擎 Mopsus 对这些交易进行预执行,并根据交易的运行时状态和结果来检测攻击(恶意)交易。

救援交易合成

对于攻击交易,IronDome 将自动合成一个救援交易及其辅助合约。救援交易将采用与攻击交易类似的方法来“利用”易受攻击的合约,但会将利润转移到我们的安全账户(一个多签账户),而不是攻击者控制的账户。例如,我们可以自动部署与攻击合约类似的辅助合约,但将代币转账地址替换为我们的安全账户。当然,对于某些攻击交易,需要使用更复杂的方法。

对于救援交易,我们需要使其在攻击交易之前上链。在当前系统中,我们为此利用 FlashBot。首先,我们必须确保其他人无法监听我们的救援交易。其次,我们可以采取一些策略来使我们的救援交易排在区块的前面。

代表性的成功案例

我们在 2022 年初部署了 IronDome。该系统已成功检测并阻止了多次攻击。 此表 总结了一些成功案例。

下面的时间线展示了我们的系统如何在 2022 年 4 月底为 Saddle Finance 挽回了 380 万美元。特别是,我们的系统在不到一秒的时间内完成了从检测攻击交易到自动合成救援交易的整个过程。我们将所有被挽回的资金归还给了 Saddle Finance。点击链接查看原始攻击交易我们的救援交易

道德考量

我们在系统中认真对待安全道德。尽管我们的系统“利用”了易受攻击的合约来挽回用户资产,但我们认为此举不存在道德问题。

  • 首先,我们的系统不主动利用易受攻击的合约。它只在检测到待处理的攻击交易时做出反应,并自动合成一个类似的交易(以阻止攻击交易)。它从未自己创建攻击交易。
  • 其次,我们积极与受影响的协议沟通,并返还被挽回的资金。

局限性

尽管 IronDome 已显示出其有效性,但该系统仍存在一些局限性。在接下来的内容中,我们将阐述这些局限性,并讨论主动威胁防护的进一步方向。

  • 首先,我们的系统监听内存池中的待处理交易。如果攻击者利用了某些私有交易服务(例如 FlashBot),攻击交易将不会出现在内存池中,因此无法被检测到。为解决此问题,我们呼吁与私有交易服务提供商合作,以检测和阻止攻击交易(采用与我们系统检测恶意交易类似的方法)。此外,即使我们的系统无法在待处理工具中阻止攻击交易,它仍然可以在链上检测到攻击交易,并发送救援交易以防止进一步的攻击交易。请注意,在许多情况下,会发生不止一次攻击交易。
  • 其次,安全是一场军备竞赛。我们已经看到攻击者提高了合成救援交易的难度。例如,他们可以将一个攻击交易分解成多个交易,并混淆利润地址。尽管这些问题可以解决,但我们认为这场军备竞赛不会停止。我们正在研究解决方案来解决这些问题。
  • 第三,如何让救援交易在攻击交易之前上链仍然是一个悬而未决的问题。尽管一些竞价策略可以提高我们的救援交易被打包进区块的几率,但我们无法获得 100% 的保证。

参考和进一步阅读

[1] 如何让区块链攻击“可被阻止” | 作者:BlockSec

[2] The Block:稳定币 DEX Saddle Finance 被盗 1000 万美元

[3] Lend 漏洞分析 — HomeCoin (mirror.xyz)

[4] Equalizer Finance 在 Twitter 上发文:“我们已从以太坊和 BSC 的金库中追回了资金。现在团队正在努力追回 Polygon 和 Optimism 链上的资金。非常感谢 @BlockSecTeam,他们设法阻止了攻击者,保护并归还了资产!” / Twitter

[5] FSWAP 在 Twitter 上发文:“FSWAP 流动性进展攻击详情” / Twitter

[6] https://forta.org/blog/blocksec-and-forta-work-to-secure-web3-beyond-audits/

[7] https://forta.org/blog/the-future-of-threat-prevention-in-web3/

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.