Back to Blog

Web3 主动威胁防护安全

Phalcon
January 28, 2023
5 min read

引言

在过去三年中,我们观察到 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
Newsletter - April 2026
Security Insights

Newsletter - April 2026

In April 2026, the DeFi ecosystem experienced three major security incidents. KelpDAO lost ~$290M due to an insecure 1-of-1 DVN bridge configuration exploited via RPC infrastructure compromise, Drift Protocol suffered ~$285M from a multisig governance takeover leveraging Solana's durable nonce mechanism, and Rhea Finance incurred ~$18.4M following a business logic flaw in its margin-trading module that allowed circular swap path manipulatio

~$7.04M Lost: GiddyDefi, Volo Vault & More | BlockSec Weekly
Security Insights

~$7.04M Lost: GiddyDefi, Volo Vault & More | BlockSec Weekly

This BlockSec weekly security report covers eight attack incidents detected between April 20 and April 26, 2026, across Ethereum, Avalanche, Sui, Base, HyperLiquid, and MegaETH, with total estimated losses of approximately $7.04M. The highlighted incident is the $1.3M GiddyDefi exploit, where the attacker did not break any cryptography or use a flash loan but simply replayed an existing on-chain EIP-712 signature with the unsigned `aggregator` and `fromToken` fields swapped out for a malicious contract, demonstrating how partial signature coverage turns any historical signature into a generic permit. Other incidents include a $3.5M Volo Vault operator key compromise on Sui, a $1.5M Purrlend privileged-role takeover, a $413K SingularityFinance oracle misconfiguration, a $142.7K Scallop cross-pool index injection, a $72.35K Kipseli Router decimal mismatch, a $50.7K REVLoans (Juicebox) accounting pollution, and a $64K Custom Rebalancer arbitrary-call exploit.

The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis
Security Insights

The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis

This BlockSec deep-dive analyzes the KelpDAO $290M rsETH cross-chain bridge exploit (April 18, 2026), attributed to the Lazarus Group, tracing a causal chain across three layers: how a single-point DVN dependency enabled the attack, how DeFi composability cascaded the damage through Aave V3 lending markets to freeze WETH liquidity exceeding $6.7B across Ethereum, Arbitrum, Base, Mantle, and Linea, and how the crisis forced decentralized governance to exercise centralized emergency powers. The article examines three parameters that shaped the cascade's severity (LTV, pool depth, and cross-chain deployment count) and provides an exclusive technical breakdown of Arbitrum Security Council's forced state transition, an atomic contract upgrade that moved 30,766 ETH without the holder's signature.