arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.07586cs.CR
收藏

分析从问答网站复制粘贴存在漏洞的Solidity代码片段的影响

Analyzing the Impact of Copying-and-Pasting Vulnerable Solidity Code Snippets from Question-and-Answer Websites

Konrad Weiss, Christof Ferreira Torres, Florian Wendland

AI总结:

该研究针对智能合约开发中复用问答网站漏洞代码的问题,提出基于代码属性图的漏洞检测工具和模糊哈希克隆检测法,经大规模样本验证发现大量已部署合约存在漏洞代码复用问题。

摘要:

以太坊智能合约是部署在区块链上的可执行程序。由于其固有的不可篡改性,一旦部署便无法更新。此外,它们通常管理着价值数百万美元的宝贵资产,因此成为攻击者的诱人目标。因复用Stack Overflow等问答网站上发布的存在漏洞的代码而导致程序引入漏洞并非新问题,但针对已部署智能合约中这一问题的严重程度,目前开展的分析工作仍较少。本文针对智能合约开发过程中复用问答网站漏洞代码的影响展开研究,并提供了专门适用于检测完整及不完整智能合约代码中漏洞代码模式的工具。本文提出了一种基于模式的漏洞检测工具,该工具基于代码属性图的概念,既能分析代码片段(即不完整代码),也能分析完整智能合约。我们还提出了一种利用模糊哈希的方法,可在已部署的智能合约中快速检测漏洞代码片段的代码克隆。研究结果表明,我们的漏洞搜索方法及代码克隆检测方法的性能与当前最优水平相当,且可应用于代码片段场景。我们对18660个代码片段开展的大规模研究显示,其中4596个存在漏洞,而这些漏洞片段中有616个可在7852个已部署智能合约中找到。这些结果凸显出,复用存在漏洞的代码片段确实是当前已部署智能合约中存在的一个问题。

英文摘要:

Ethereum smart contracts are executable programs deployed on a blockchain. Once deployed, they cannot be updated due to their inherent immutability. Moreover, they often manage valuable assets that are worth millions of dollars, making them attractive targets for attackers. The introduction of vulnerabilities in programs due to the reuse of vulnerable code posted on Q&A websites such as Stack Overflow is not a new issue. However, little effort has been made to analyze the extent of this issue on deployed smart contracts. In this paper, we conduct a study on the impact of vulnerable code reuse from Q&A websites during the development of smart contracts and provide tools uniquely fit to detect vulnerable code patterns in complete and incomplete Smart Contract code. This paper proposes a pattern-based vulnerability detection tool that is able to analyze code snippets (i.e., incomplete code) as well as full smart contracts based on the concept of code property graphs. We also propose a methodology that leverages fuzzy hashing to quickly detect code clones of vulnerable snippets among deployed smart contracts. Our results show that our vulnerability search, as well as our code clone detection, are comparable to state-of-the-art while being applicable to code snippets. Our large-scale study on 18,660 code snippets reveals that 4,596 of them are vulnerable, out of which 616 can be found in 7,852 deployed smart contracts. These results highlight that the reuse of vulnerable code snippets is indeed an issue in currently deployed smart contracts.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑