Due to the open-source nature of the blockchain ecosystem, it is common for new blockchains to fork or partially reuse the code of classic blockchains. For example, the popular Dogecoin, Litecoin, Binance BSC, and Polygon are all variants of Bitcoin/Ethereum. These "forked" blockchains thus could encounter similar vulnerabilities that are propagated from Bitcoin/Ethereum during forking or subsequently commit fetching. In this paper, we conduct a systematic study of detecting and investigating the propagated vulnerabilities in forked blockchain projects. To facilitate this study, we propose BlockScope, a novel tool that can effectively and efficiently detect multiple types of cloned vulnerabilities given an input of existing Bitcoin/Ethereum security patches. Specifically, BlockScope adopts similarity-based code match and designs a new way of calculating code similarity to cover all the syntax-wide variant (i.e., Type-1, Type-2, and Type-3) clones. Moreover, BlockScope automatically extracts and leverages the contexts of patch code to narrow down the search scope and locate only potentially relevant code for comparison. Our evaluation shows that BlockScope achieves good precision and high recall both at 91.8% (1.8 times higher recall than that in ReDeBug). BlockScope allows us to discover 101 previously unknown vulnerabilities in 13 out of the 16 forked projects of Bitcoin and Ethereum, including 16 from Dogecoin, 6 from Litecoin, 1 from Binance, and 4 from Optimism. We have reported all the vulnerabilities to their developers; 40 of them have been patched or accepted, 66 were acknowledged or under pending, and only 4 were rejected. We further investigate the propagation and patching processes of discovered vulnerabilities, and reveal three types of vulnerability propagation from source to forked projects, as well as the long delay (over 200 days) for releasing patches in Bitcoin forks.
翻译:由于区块链生态系统的开源特性,新兴区块链常通过分叉或部分复用经典区块链代码进行开发。例如,流行的狗狗币、莱特币、币安智能链和Polygon均源自比特币/以太坊的变体。这些“分叉”区块链可能继承比特币/以太坊在分叉或后续代码拉取过程中传播的相似漏洞。本文系统性地研究了分叉区块链项目中传播漏洞的检测与调查。为此,我们提出BlockScope这一新型工具,能够基于输入的现有比特币/以太坊安全补丁,高效准确地检测多类型克隆漏洞。具体而言,BlockScope采用基于相似度的代码匹配技术,并设计了一种新的代码相似度计算方法,覆盖所有语法变体(即Type-1、Type-2和Type-3)的克隆。此外,BlockScope自动提取并利用补丁代码上下文,缩小搜索范围,仅定位潜在相关代码进行比较。实验评估表明,BlockScope实现了91.8%的精确率与召回率(召回率较ReDeBug提升1.8倍)。利用BlockScope,我们在16个比特币/以太坊分叉项目中的13个发现了101个此前未知的漏洞,包括狗狗币16个、莱特币6个、币安1个、Optimism 4个。所有漏洞均已报告给开发者:其中40个已被修补或确认,66个处于确认或待处理状态,仅4个被驳回。我们进一步调研了漏洞的传播与修补过程,揭示了源项目到分叉项目的三种漏洞传播模式,以及比特币分叉项目中补丁发布存在的长期延迟(超过200天)。