Back to Blog

BlockSec 关于 L2 区块链安全性的见解与解决方案

Code Auditing
February 1, 2024
5 min read

近期,L2 解决方案在区块链领域因解决可扩展性问题而受到广泛关注。借助 L2 解决方案,应用程序甚至可以开发自己的链,称为应用链,以处理高频交易。根据 L2beat(https://l2beat.com/scaling/summary)的数据,目前有 37 个活跃项目,截至 2024 年 2 月 1 日,总锁仓价值(TVL)为 207.9 亿美元。

然而,随着 L2 区块链的普及,我们也发现了一些需要解决的安全挑战,包括如何确保私钥的安全性、如何保护跨链和顶层协议的交易安全,以及如何为开发者提供安全开发基础设施等。

在本篇博客中,我们将首先系统地回顾这些挑战,然后提出我们的解决方案。

为什么需要 L2

为什么我们需要 L2 区块链?我们认为从技术和财务角度来看,存在不同的原因。

技术视角

L2 区块链的动机是解决 L1 区块链的可扩展性问题。基本思想是,与将所有交易提交到 L1 链(由于区块大小和共识机制已经拥挤)不同,交易可以在单独的链(称为 L2 链)上执行,并且只将状态变更的摘要提交到 L1 链,如下图所示,来自 Chainlink(https://chain.link/education-hub/zero-knowledge-rollup)。

图片来源:ChainLink

财务视角

另一个动机来自财务角度,即在新的应用链上构建生态系统。这可以为应用程序提供多种好处。

  • 首先,应用链可以实现更快的交易处理和更低的 Gas 消耗,从而节省用户成本并提高可用性。这可以为应用链带来经济增长。

  • 其次,该链可以为开发者和业务合作伙伴提供定制化的激励机制。例如,它们可以与他们分享 Gas 费,甚至可以创造新的市场,如交易拍卖。

  • 第三,通过构建生态系统,该链可以吸引更多业务合作伙伴加入该系统,并满足 L1 区块链无法满足(或成本过高)的要求。

当然,到目前为止我们讨论的是基于以太坊的 L2 链。我们也看到了一些称为 BTC L2 的 L2 解决方案。我们不会详细介绍它们,但我们看到其中一些正在利用 BTC 网络提供的流动性(包括 BTC 和 NFT、铭文等其他代币),并桥接到 EVM 兼容链。

安全要求与挑战

我们认为 L2 区块链运营商需要考虑一些安全挑战。鉴于 L2 区块链的出现速度过快,底层基础设施、操作经验和 L2 区块链运营的安全知识都滞后于发展,这一点尤为重要。这可能会对每个 L2 链的整个生态系统造成损害。

  • 首先,L2 链本身应该充分认识到链上顶层协议的安全性,特别是对于主要 TVL 来自少数协议的应用链而言。这需要实时检测可疑和恶意智能合约及交易并立即采取行动的能力。应建立安全事件响应程序来处理攻击。

  • 其次,应该使用一种架构来保护 L2 链使用的私钥。例如,在 OP rollup stack 中,sequencer 用于在 L2 上签名区块,batcher 用于在 L1 上发布交易。如果这些关键的私钥泄露,那么 L2 链的整体安全性将受到损害。

  • 第三,应该为链开发安全工具或框架。例如,应该开发用于分析可疑交易和执行安全测试的工具。社区的安全研究人员可以利用这些工具来分析交易,快速了解其安全影响。

  • 最后但同样重要的是,应考虑 L2 链的底层云基础设施的安全性。例如,L2 节点可能会遭受 DDoS 攻击,云基础设施的访问令牌可能以各种方式泄露,例如社会工程攻击。应提前准备缓解措施和安全策略。

我们的解决方案

作为一家全栈安全提供商,BlockSec 可以成为您深入的安全合作伙伴,并通过我们的服务和工具来帮助保护 L2 区块链。

  • 高质量的安全代码审计。BlockSec 为 DeFi 协议提供勤勉的代码审计服务。通过利用基于学术研究的静态分析工具、动态模糊测试和差分测试框架,我们的代码审计涵盖了协议和底层的 EVM 执行引擎。我们已在区块链执行引擎(EVM 和 RBPF)中检测到多项漏洞,并获得了超过 100 万美元的奖励。

  • 攻击交易监控和阻止。凭借久经考验的技术,BlockSec Phalcon 可以帮助 L2 监控攻击交易,包括直接交易到 L2 的交易以及从 L1 跨链的交易。此外,我们还可以帮助保护从其他 L1/L2 链通过代币桥(例如 LayerZeroCeler)桥接的资产。此外,还可以将一种更主动的阻止攻击交易的解决方案深度集成到 L2 链中(如需了解更多信息,请联系我们)。

  • 基于硬件的私钥安全解决方案。我们提供在安全硬件内部生成、管理私钥和签名交易的服务。它兼具热钱包的优势和冷钱包的安全性。它可以安全地签名交易,并且具有支持更多算法的扩展性(如有必要)。与 MPC 和 HSM 等其他解决方案相比,它更灵活、更高效、更实用。

  • 安全开发工具和平台。Phalcon Explorer(https://blocksec.com/explorer)是安全社区分析攻击交易以了解根本原因的事实上的分析工具。它已被社区用于分析数百起安全事件(https://phalcon.blocksec.com/explorer/security-incidents)。Phalcon Fork(https://blocksec.com/fork)是一个可以在具有镜像状态的 Forked 网络上执行安全测试的平台。请随时联系我们,用我们的工具支持您的 L2 链

  • 安全事件响应。BlockSec 始终是识别 DeFi 黑客攻击根源和漏洞最快的(如果不是第一个)安全供应商。我们可以帮助协议审查安全补丁(Telcoin),提供白基金救援(例如 AnySwapTransitSwapParaspaceLoot),追踪黑客资金流向(https://metasleuth.io),并确定 Hopeland 攻击者的身份。

总结

L2 区块链的专有性创造了机遇,但也面临严峻的安全挑战。我们的安全解决方案可以帮助 L2 区块链审计代码、检测和阻止黑客攻击、保护私钥、提供安全开发工具,并协助解决安全事件。

立即联系我们 ([email protected]),以保护您的 L2 链并赢得用户的信任!

Sign up for the latest updates
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.

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026

This BlockSec weekly security report covers four attack incidents detected between April 13 and April 19, 2026, across multiple chains such as Ethereum, Unichain, Arbitrum, and NEAR, with total estimated losses of approximately $310M. The highlighted incident is the $290M KelpDAO rsETH bridge exploit, where an attacker poisoned the RPC infrastructure of the sole LayerZero DVN to fabricate a cross-chain message, triggering a cascading WETH freeze across five chains and an Arbitrum Security Council forced state transition that raises questions about the actual trust boundaries of decentralized systems. Other incidents include a $242K MMR proof forgery on Hyperbridge, a $1.5M signed integer abuse on Dango, and an $18.4M circular swap path exploit on Rhea Finance's Burrowland protocol.

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026

This BlockSec weekly security report covers four DeFi attack incidents detected between April 6 and April 12, 2026, across Linea, BNB Chain, Arbitrum, Optimism, Avalanche, and Base, with total estimated losses of approximately $928.6K. Notable incidents include a $517K approval-related exploit where a user mistakenly approved a permissionless SquidMulticall contract enabling arbitrary external calls, a $193K business logic flaw in the HB token's reward-settlement logic that allowed direct AMM reserve manipulation, a $165.6K exploit in Denaria's perpetual DEX caused by a rounding asymmetry compounded with an unsafe cast, and a $53K access control issue in XBITVault caused by an initialization-dependent check that failed open. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Best Security Auditor for Web3

Validate design, code, and business logic before launch. Aligned with the highest industry security standards.

BlockSec Audit