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

ContractTinker:面向真实世界智能合约的大语言模型赋能漏洞修复方法

ContractTinker: LLM-Empowered Vulnerability Repair for Real-World Smart Contracts

Che Wang, Jiashuo Zhang, Jianbo Gao, Libin Xia, Zhi Guan, Zhong Chen

AI总结:

针对现有智能合约漏洞修复工具语义理解不足、难以处理真实漏洞的问题,提出结合思维链拆解与静态分析引导的LLM赋能修复工具ContractTinker,在48个高危漏洞上实现48%的有效修复率与21%的微改可用率。

摘要:

智能合约易受攻击者利用,尤其是在面临真实世界漏洞时风险更高。为降低这一风险,开发者通常依赖第三方审计服务在项目部署前识别潜在漏洞。尽管如此,修复已识别的漏洞仍然复杂且耗费人力,对缺乏安全专业知识的开发者而言尤其困难。此外,现有的基于模式的修复工具因缺乏高层语义理解,大多无法应对真实世界的漏洞。为填补这一空白,我们提出ContractTinker,一款由大语言模型(Large Language Models, LLMs)赋能的真实世界漏洞修复工具。其核心思路是采用思维链(Chain-of-Thought)方法将整个生成任务拆解为多个子任务。此外,为减少幻觉问题,我们整合了程序静态分析来引导LLM。我们在48个高危漏洞上对ContractTinker进行了评估,实验结果显示,在ContractTinker生成的补丁中,23个(48%)是可修复漏洞的有效补丁,另有10个(21%)仅需少量修改即可使用。ContractTinker的演示视频可访问https://youtu.be/HWFVi-YHcPE查看。

英文摘要:

Smart contracts are susceptible to being exploited by attackers, especially when facing real-world vulnerabilities. To mitigate this risk, developers often rely on third-party audit services to identify potential vulnerabilities before project deployment. Nevertheless, repairing the identified vulnerabilities is still complex and labor-intensive, particularly for developers lacking security expertise. Moreover, existing pattern-based repair tools mostly fail to address real-world vulnerabilities due to their lack of high-level semantic understanding. To fill this gap, we propose ContractTinker, a Large Language Models (LLMs)-empowered tool for real-world vulnerability repair. The key insight is our adoption of the Chain-of-Thought approach to break down the entire generation task into sub-tasks. Additionally, to reduce hallucination, we integrate program static analysis to guide the LLM. We evaluate ContractTinker on 48 high-risk vulnerabilities. The experimental results show that among the patches generated by ContractTinker, 23 (48%) are valid patches that fix the vulnerabilities, while 10 (21%) require only minor modifications. A video of ContractTinker is available at https://youtu.be/HWFVi-YHcPE.

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

↑