一文读懂跨链桥的七大关键漏洞

币圈资讯 阅读:41 2024-04-22 05:05:08 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

据DefiLlama报道,迄今为止,跨链桥累计被盗资金超过28亿美元,几乎占整个Web3行业被盗资金总量的40%。 

整个Web3行业被盗资金总量为76.8亿美元,其中跨链桥被盗资金就达28.3亿美元,是受攻击最严重的赛道之一

毋庸置疑,跨链是激发Web3创新的关键要素。然而,它也会造成潜在的攻击向量。在软件行业中,许多开发者都信奉“快速破局”(move fast and break things)的原则。但一旦涉及到几百亿甚至几万亿美元用户资金的跨链安全性,这条原则就完全行不通了。如果你速度太快,就可能出问题。

什么是跨链桥?

跨链桥是一种去中心化应用,能够将资产从一条区块链转移到另一条区块链。 

如今,跨链桥在设计和用途上都大相径庭。比如,一些跨链桥专门用于在L2和底层区块链之间转账。而基于Chainlink CCIP等跨链协议开发的通用型跨链桥则可以在各条区块链之间无缝传输资产和消息。 

跨链桥是Web3基础设施的核心要素。对用户来说,跨链桥可以在链与链之间无缝转移通证和消息;而对开发者来说,则可以利用跨链协议来打造可兼容任何区块链的用户体验,极大简化基础设施。如今,所有跨链桥每月的交易量共计60多亿。显而易见,这个赛道已经成为了Web3生态不可或缺的一环,并得到了广泛应用。

因此,无论是用户、开发者还是机构,如果想要研究跨链赛道,都必须了解跨链桥的七大关键漏洞,以保护自身、用户以及利益相关方的安全。  

私钥管理漏洞

跨链桥通常会使用一个或一组私钥来管理。一个或多个跨链桥运行节点各自会持有一把独特的私钥。他们的任务是对用户发送的跨链消息或传输的价值达成共识,并准确地将消息或价值进行跨链传输。他们会使用私钥来进行数字签名,或使用多个私钥组成门限签名,以批准跨链消息。 

因此,私钥被盗是跨链桥最常见的漏洞之一。Web3行业中最臭名昭著的跨链桥被盗事件都是因为私钥被盗导致的。而私钥被盗通常是因为私钥管理或跨链桥运行安全出现漏洞。 

一个大致的原则就是,跨链桥及其私钥如果在服务器、基础设施提供方、部署地点和节点运营商这几个方面越去中心化,那么就越有能力防范单点失效和中心化风险。 

中心化的网络不仅容易被攻击,还会出现某一方全权控制所有用户资金的情况

去中心化的模式可以有效防范中心化风险。在去中心化模式下,任何攻击者(或甚至运行跨链桥的节点)都必须同时对多个独立实体的私钥进行攻击,才有可能成功,因此极大降低了内外部攻击发生的概率。这是一种非常稳健的安全模式。不过,要保障私钥安全还需要考虑到其他因素。另外一个同样重要的因素就是,各个跨链桥运行节点需要独立地采用不同的安全机制来保障私钥安全。

最佳实践

虽然去中心化可以很好地避免单点失效,但要保障私钥安全还需要同时采取多种措施。安全性最高的跨链协议通常既会采用去中心化的模式来保障安全,也会采用成熟的解决方案来保存私钥,比如硬件安全模块(HSM)、加密(传输中的数据和静止数据)、网络诈骗防范教育、权限控制以及密钥管理服务等。

由于私钥被盗导致跨链桥遭受攻击的真实案例

  • Ronin跨链桥(2022年3月)——在Ronin跨链桥上开展、审批和执行交易所需的九把私钥中有五把被盗。 

  • Harmony跨链桥(2022年6月)——在Harmony跨链桥上开展、审批和执行交易所需的五把私钥中有两把被盗。  

  • Multichain跨链桥(2023年7月)——跨链桥私钥被盗,导致资金未经审批就被取出。而这些私钥都由Multichain的CEO一人持有。

  • Orbit Chain(2024年1月)——Orbit Chain跨链桥的十把私钥中有七把被盗,导致资金池被抽干。

智能合约审计漏洞

由于跨链桥的主要功能是将价值从一条链转移到另一条链,因此所有跨链协议都必须涉及到智能合约。

在大多数的跨链用例中,都需要使用多条链上的智能合约来铸造、销毁、锁定或解锁跨链通证。这些智能合约通过跨链桥连接,通常会与通证发行方建立合作。

可以说,智能合约是防止跨链桥被盗的额外安全层,但如果智能合约本身出现漏洞,也有可能导致技术风险。一方面,智能合约为跨链桥提供了宝贵的平台,可以开展各类常规安全检查,比如确保用户取出的金额不超过存入的金额以及设置跨链桥的速率限制(rate limit)。另一方面,如果智能合约代码质量很差或没有经过严格审计,那么就会适得其反。黑客利用智能合约代码漏洞已经从多个跨链桥盗走了数额庞大的资金。

任何项目,无论它对安全多么看重,都无法完全保障它的智能合约代码中没有技术漏洞。不过有一个非常成熟的方案可以保障代码的稳健性,那就是与经验丰富的第三方审计合作,对项目代码库进行测试,测试通过后再发布。这并非一劳永逸的事情,因为一旦代码库在审计后做了更改,或未审计的智能合约添加到了已审计的代码库中,那么即使是最完备的代码库都会立即回到未审计的状态。

最佳实践

在使用跨链协议时,智能合约的风险是真实存在的。安全性最高的跨链桥往往会对其代码库持续展开多次内部审计和竞争性的外部审计。另外,这些跨链桥还会开展一系列内部安全测试,比如模糊测试、静态分析、形式验证以及符号执行等。

如果要了解跨链桥潜在的技术风险,就需要查看其代码库的审计次数以及审计人员等相关信息。另外,还需要建立紧急关停和紧急更新等多层安全模式,并设置速率限制,这些都可以有效降低智能合约漏洞的风险。

由于智能合约漏洞导致的跨链桥被盗真实案例

  • Wormhole跨链桥(2022年2月)——黑客找到了跨链桥智能合约中验证步骤的漏洞,在抵押资产不足的情况下在Solana链上铸造了12万枚wETH。 

  • Nomad跨链桥(2022年8月)——跨链桥智能合约代码中默认接受的根账户(0x00)实现方式出现了错误,导致任何人都可以从跨链桥中盗走资金。 

  • 币安跨链桥(2022年10月)——跨链桥智能合约中IAVL默克尔证明验证系统存在漏洞,导致跨链桥被攻击。此次攻击导致200万个BNB从跨链桥转到了攻击者账户。

  • Socket互操作性协议(2024年1月)——协议智能合约存在漏洞,导致钱包对Socket智能合约出现无限批准。  

升级流程漏洞

可升级性指智能合约代码的升级能力,或更改智能合约代码中部分参数配置的能力。 

开发者通常会采用可升级的智能合约来进行升级,以添加新功能、解决智能合约逻辑错误并修改关键的风险参数。跨链桥可以通过升级来添加新的通证和区块链,采用新技术来验证跨链消息,调整资金提取限额和节点构成等关键风险参数,并迅速解决底层智能合约中新发现的任何逻辑错误。 

可升级的智能合约需要在终端用户、前端实现和底层智能合约之间开发代理合约

可升级性对于安全来说至关重要,因为如果升级流程出现漏洞,就可能造成潜在的攻击向量。跨链桥要具备安全的可升级性,就需要采取深度防御机制,其中包括建立稳健的私钥管理机制,密钥由多个独立实体分别持有;采用时间锁延迟机制,让用户可以在链上更改生效前提前查看;建立稳健的审批流程,比如跨链桥运行节点可以一票否决在时间锁有效期内的决议。在特殊情况下,如果需要快速实现升级,跨链桥运行节点在评估更改决议后可以直接审批通过。 

最佳实践

要不断适应发展需要并应对未知状况,就必须实现可升级性。然而,升级流程如果存在漏洞,可能会为跨链协议带来潜在风险。时间锁智能合约和节点一票否决机制是重要的工具,可以加固升级流程。然而,要保障跨链桥安全还必须制定应急预案,并同时保障最高水平的安全性。 

依赖单一网络

一些跨链桥依赖单一验证节点网络进行所有跨链操作。如果跨链桥专门用于连接两条指定的区块链,那么单一网络这个方案也许可行。但如果要用通用型跨链桥连接多链世界,那这个方案既不安全也不可扩展。

避免使用这类跨链桥有一个最重要的原因,那就是一旦跨链桥被攻击,用户受到的打击最为严重。由于所有跨链交易及其价值都由一个网络支撑,所以一旦网络成功被攻陷,所有区块链的跨链桥都会全军覆没,风险几乎无法隔离。

利用多个独立的去中心化网络可以有效隔离风险,防止因一次跨链桥攻击导致所有区块链和用户的资金全部被盗

采用独立的多网络设计结构是更加安全且可扩展的解决方案,具体如下:

  • 跨链通道由独立的去中心化网络运行。 这意味着,每条跨链通道都有一个独立的去中心化网络,每两条区块链之间都有一条单独的跨链通道。这样做可以将一次攻击的影响限制在某一条跨链通道内。

  • 每条跨链通道都由多个网络保障安全。安全性最高的跨链桥和协议都会为每条跨链通道创建多个网络,以增强安全性。这样一来,攻击者必须要同时攻陷一条安全通道的多个网络,才能成功。因此,这也为安全通道提供了额外的安全层。

Chainlink CCIP为单一跨链通道建立多个网络,是唯一一个达到第五层(也是最高层)跨链安全性的跨链协议

最佳实践

为每条跨链通道都创建多个独立的去中心化网络,可以大幅降低攻击面以及攻击者的回报率。这个方案的最佳实践还包括采用多种编程语言开发客户端,以实现客户端的多样性;创建单独的节点集合,保障这些节点与网络节点无重叠;以及添加主动风控功能。

验证节点集合质量差

验证节点是所有跨链桥的灵魂。节点包括各类人员和组织,他们负责维护基础设施,运行跨链桥功能。

用户、机构和dApp开发者应该警惕验证节点由于缺乏经验和知识而导致无法安全运行跨链桥的风险。安全性最高的跨链桥通常会要求其验证节点拥有世界一流的水平和丰富的经验,保障运行安全(OPSEC),妥善保管私钥并可靠处理和执行跨链交易。  

Chainlink节点和预言机网络由世界一流的节点运营商负责运行

其中第二点经常被用户、开发者和机构所忽略。对于任何一个跨链桥用户来说,节点网络最大的风险就是无法可靠地执行交易。比如,用户在一条链上锁定资金,然后准备在另一条链上铸造相应的资金。但如果由于节点网络下线而无法批准铸造,那么用户资金实际上就会被冻结。

最佳实践

跨链桥应该只采用优质的节点,并且这些节点要具备丰富的运行安全经验、卓越的性能和强大的稳健性。运行安全并非Web3独有的能力,因此许多Web2和Web3的验证节点都可以加入。不过在招募跨链桥节点时很有必要核实节点的过往记录。另外,还可以要求验证节点进行质押,一旦出现违规行为或操作,质押的保证金就会被没收。这样做可以激励验证节点诚实可靠地展开工作,并创建新的经济安全层。 

缺乏主动交易监控

主动监控交易的目的是实时监控跨链桥的异常行为,并作出响应。如果主动交易监控机制实施得当,就可以很好地监测到可疑行为并立刻采取必要的防御措施,以防范攻击。 

主动交易监控的一个典型用例就是在执行可疑交易前或通过恶意交易后紧急关停跨链系统。恶意交易包括在抵押资产不足的情况下成功取走跨链桥的全部资产。 

由于缺乏主动交易监控而导致的跨链桥被盗真实案例

  • Ronin跨链桥(2022年3月)——据Halborn区块链安全公司所称,Ronin跨链桥被盗6天后才被人发现。如果Ronin建立了主动交易监控机制,本来可以及时发现并解决这个问题的。 

最佳实践

主动交易监控通常由一组与跨链桥主节点完全不相关的独立实体或节点网络组成。这样做可以清晰划分责任,并实现相互制衡的机制,降低一个或一组节点操纵实时响应的可能性。

缺乏速率限制

速率限制(rate limit)并不是一个新的概念。在传统软件行业中,速率限制是网站采用的一种安全机制,目的是防范DoS攻击。数据提供方也会采用这种机制来防范过多API请求导致的服务器宕机。 

这个概念非常简单,即:在时间和数量的维度上限制请求数量。那么是什么样的请求呢?在跨链世界中,速率限制指限制某一段时间内两条链之间可以传输的最大资金价值。 

这个安全机制看上去虽然简单,但却是跨链桥最后一道坚实的防线。即使黑客成功穿透了其他所有防线,速率限制仍可以限制他们能够从跨链桥盗取的金额。 

速率限制就像是在水桶上穿一个小洞,在单位时间内只有定量的水可以流出来

由于缺乏速率限制而导致的跨链桥被盗真实案例

  • 如果设置了速率限制和紧急关停功能,并且在实现过程中没有任何逻辑错误,那么所有跨链桥攻击中短时间内被盗的资金都可以被限制在一定金额内。 

最佳实践

每条跨链通道的速率限制都应该定制化,以在最大程度上实现安全性和模块化。另外,每条跨链通道还应该限制所有资产加在一起的跨链传输总额。设置合理的吞吐量速率(即:每十分钟最多传输X枚通证)可以有效防范攻击者在一次交易中抽干资产池中的所有资产。另外,还可以针对各个跨链资产和跨链通道设置“充值速率”(refill rate),以避免攻击者等到速率限制归零后再盗走上限资产。 

Chainlink CCIP可以实现

前所未有的跨链安全性

我们要明白一点,那就是要实现跨链安全性,只采取某一种安全机制是不够的。实际上,要建立稳健的跨链安全模式,需要采取深度防御机制,综合使用多种安全机制,全面地防范攻击。

安全性最高的跨链桥通常采用深度防御机制,综合使用多种安全机制。

这也是我们构建行业标准的跨链解决方案Chainlink CCIP的初衷。 


It is reported that so far, the accumulated stolen funds of cross-chain bridges have exceeded billion dollars, accounting for almost the total stolen funds of the whole industry, and the total stolen funds of cross-chain bridges have reached billion dollars, which is one of the most seriously attacked tracks. Undoubtedly, cross-chain is the key factor to stimulate innovation, but it will also cause potential attack vectors. In the software industry, many developers believe in the principle of quick break, but once tens of billions or even trillions of dollars of user funds are involved, cross-chain security. The principle of sex doesn't work at all. If you are too fast, there may be problems. What is a cross-chain bridge? A cross-chain bridge is a decentralized application that can transfer assets from one blockchain to another. Nowadays, cross-chain bridges are very different in design and use. For example, some cross-chain bridges are specially used to transfer money with the underlying blockchain, while general cross-chain bridges developed based on equal cross-chain protocols can seamlessly transfer assets and messages between various blockchains. Cross-chain bridges are the core of infrastructure. For users, cross-chain bridges can seamlessly transfer certificates and messages between chains, while for developers, cross-chain protocols can be used to create a user experience compatible with any blockchain, which greatly simplifies the infrastructure. Nowadays, the monthly transaction volume of all cross-chain bridges totals more than 100 million. Obviously, this track has become an indispensable part of the ecology and has been widely used. Therefore, whether users, developers or institutions want to study cross-chain bridges, they must understand the seven key leaks of cross-chain bridges. Hole to protect the security of its own users and stakeholders. Private key management loopholes Cross-chain bridges usually use one or a group of private keys to manage one or more cross-chain bridges. Running nodes will each hold a unique private key. Their task is to reach a consensus on the value of cross-chain messages or transmissions sent by users and accurately transmit the messages or values across the chain. They will use private keys to digitally sign or use multiple private keys to form a threshold signature to approve cross-chain messages. Therefore, the theft of private keys is cross-chain. One of the most common vulnerabilities of bridges, the most notorious theft of cross-chain bridges in the industry is caused by the theft of private keys, which is usually caused by loopholes in private key management or cross-chain bridge operation security. A general principle is that if cross-chain bridges and their private keys are decentralized in server infrastructure providers and node operators, they will be more capable of preventing single point failure and centralization. A centralized network is not only easy to be attacked, but also full of one party. Decentralization mode can effectively prevent the risk of centralization in the case of controlling all users' funds. In decentralization mode, any attacker or even the node running across the chain bridge must attack the private keys of multiple independent entities at the same time to be successful, thus greatly reducing the probability of internal and external attacks. This is a very robust security mode, but other factors need to be considered to ensure the security of private keys. Another equally important factor is that each node running across the chain bridge needs to We should independently adopt different security mechanisms to ensure the security of private keys. Although decentralization can avoid single point failure, we need to take various measures at the same time to ensure the security of private keys. Cross-chain protocols with the highest security usually adopt decentralized mode to ensure security and mature solutions to save private keys, such as data in encrypted transmission of hardware security modules and static data, network fraud prevention, education authority control and key management services. The real case of theft causing the cross-chain bridge to be attacked: five of the nine private keys needed to carry out approval and execution of transactions on the cross-chain bridge in October were stolen, and two of the five private keys needed to carry out approval and execution of transactions on the cross-chain bridge in October were stolen, resulting in the funds being taken out without approval, and these private keys were all held by one person. Seven of the ten private keys on the cross-chain bridge were stolen, which led to the draining of the fund pool. Due to the audit loopholes of the cross-chain bridge, the funds were drained. The main function of the bridge is to transfer the value from one chain to another, so all cross-chain agreements must involve smart contracts. In most cross-chain use cases, smart contracts on multiple chains need to be used to cast, destroy, lock or unlock the cross-chain pass. These smart contracts are usually connected with the issuer of the pass through the cross-chain bridge. It can be said that smart contracts are an additional security layer to prevent the cross-chain bridge from being stolen, but if there are loopholes in the smart contracts themselves, it may also lead to technical risks. Energy contracts provide a valuable platform for cross-chain bridges to carry out all kinds of routine security checks, such as ensuring that the amount of money withdrawn by users does not exceed the amount of money deposited, and setting the speed limit of cross-chain bridges. On the other hand, if the quality of smart contract code is poor or has not been strictly audited, it will be counterproductive. Hackers have stolen a huge amount of money from multiple cross-chain bridges by taking advantage of the loopholes in smart contract code. No matter how important it is to security, any project cannot fully guarantee its smart contract code. There are no technical loopholes, but there is a very mature scheme to ensure the robustness of the code, that is, to cooperate with an experienced third-party audit to test the project code base before releasing it. This is not a once-and-for-all thing, because once the code base is changed after the audit or the unaudited smart contract is added to the audited code base, even the most complete code base will immediately return to the unaudited state. Best practices The risks of smart contracts when using cross-chain protocols. Cross-chain bridges with the highest security are real, and often carry out internal audits and competitive external audits on their code bases for many times. In addition, these cross-chain bridges will also carry out a series of internal security tests, such as fuzzy tests, static analysis, formal verification and symbol execution. If you want to understand the potential technical risks of cross-chain bridges, you need to check the audit times of their code bases, auditors and other related information. In addition, you need to establish multi-layer security modes such as emergency shutdown and emergency update and set the speed. Restricting these can effectively reduce the risk of smart contract loopholes. In the smart contract loopholes, the cross-chain bridge was stolen. In the real case, the hacker found the loopholes in the verification step in the cross-chain bridge smart contract. In the case of insufficient mortgage assets, 10,000 cross-chain bridges were cast on the chain. The default implementation of the root account in the cross-chain bridge smart contract code was wrong, which led to anyone stealing money from the cross-chain bridge. In the cross-chain bridge smart contract, Merkel proved that there was a loophole in the verification system, which led to the attack of 10,000 cross-chain bridges to attackers. 比特币今日价格行情网_okx交易所app_永续合约_比特币怎么买卖交易_虚拟币交易所平台

文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明 网址:https://netpsp.com/?id=57744

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
关注我们

若遇到问题,加微信客服---清歌

搜索
排行榜
扫一扫,加我为微信好友加我为微信好友