arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2309.05520cs.SE
收藏

当 ChatGPT 遇上智能合约漏洞检测:我们还有多远?

When ChatGPT Meets Smart Contract Vulnerability Detection: How Far Are We?

Chong Chen, Jianzhong Su, Jiachi Chen, Yanlin Wang, Tingting Bi, Jianxing Yu, Yanli Wang, Xingwei Lin, Ting Chen, Zibin Zheng

AI总结:

本文实证研究了ChatGPT在智能合约漏洞检测中的表现,发现其召回率高但精度有限,并与现有工具对比揭示了其在不同漏洞类型上的优劣势及鲁棒性局限。

摘要:

随着区块链技术的发展,智能合约已成为区块链应用的重要组成部分。尽管智能合约发挥着关键作用,但其开发过程可能会引入漏洞,并可能导致财务损失等严重后果。同时,以 ChatGPT 为代表的大型语言模型受到了广泛关注,在代码分析任务中展现出了强大的能力。本文提出了一项实证研究,以调查 ChatGPT 在识别智能合约漏洞方面的表现。最初,我们使用公开的智能合约数据集评估了 ChatGPT 的有效性。我们的研究发现,尽管 ChatGPT 达到了较高的召回率,但其在精确定位智能合约漏洞方面的精度有限。此外,ChatGPT 在检测不同漏洞类型时的表现各不相同。我们深入探讨了 ChatGPT 产生误报的根本原因,并将其分为四组。其次,通过将 ChatGPT 与其他最先进的智能合约漏洞检测工具进行比较,我们发现在 7 种漏洞中的 3 种上,ChatGPT 的 F-score 低于其他工具。在其余 4 种漏洞的情况下,ChatGPT 相比这些工具表现出轻微的优势。最后,我们分析了 ChatGPT 在智能合约漏洞检测中的局限性,揭示了 ChatGPT 在该领域的鲁棒性需要从两个方面进行改进:其回答问题的不确定性;以及检测代码的长度受限。总体而言,我们的研究为采用大型语言模型(特别是 ChatGPT)检测智能合约漏洞的优势和劣势提供了见解。

英文摘要:

With the development of blockchain technology, smart contracts have become an important component of blockchain applications. Despite their crucial role, the development of smart contracts may introduce vulnerabilities and potentially lead to severe consequences, such as financial losses. Meanwhile, large language models, represented by ChatGPT, have gained great attentions, showcasing great capabilities in code analysis tasks. In this paper, we presented an empirical study to investigate the performance of ChatGPT in identifying smart contract vulnerabilities. Initially, we evaluated ChatGPT's effectiveness using a publicly available smart contract dataset. Our findings discover that while ChatGPT achieves a high recall rate, its precision in pinpointing smart contract vulnerabilities is limited. Furthermore, ChatGPT's performance varies when detecting different vulnerability types. We delved into the root causes for the false positives generated by ChatGPT, and categorized them into four groups. Second, by comparing ChatGPT with other state-of-the-art smart contract vulnerability detection tools, we found that ChatGPT's F-score is lower than others for 3 out of the 7 vulnerabilities. In the case of the remaining 4 vulnerabilities, ChatGPT exhibits a slight advantage over these tools. Finally, we analyzed the limitation of ChatGPT in smart contract vulnerability detection, revealing that the robustness of ChatGPT in this field needs to be improved from two aspects: its uncertainty in answering questions; and the limited length of the detected code. In general, our research provides insights into the strengths and weaknesses of employing large language models, specifically ChatGPT, for the detection of smart contract vulnerabilities.

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

↑