一句话:提出 ContractTinker,利用思维链与静态分析引导 LLM 修复真实智能合约漏洞。
智能合约面临真实世界漏洞攻击风险,第三方审计虽能发现漏洞,但修复过程复杂且依赖安全专家,现有基于模式的工具因缺乏高层语义理解而难以奏效。为此,本文提出 ContractTinker,一种由大语言模型(LLM)赋能的真实世界漏洞修复工具。其核心洞察是采用思维链(Chain-of-Thought)将整个生成任务分解为子任务,并集成程序静态分析来引导 LLM,从而减少幻觉。在 48 个高危漏洞上的评估表明,ContractTinker 生成的补丁中 23 个(48%)为有效修复,另有 10 个(21%)仅需微小修改。视频见 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.CCS Concepts• Software and its engineering → Software development techniques; • Security and privacy → Software security engineering.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{abs-2409-09661,
title = {ContractTinker: LLM-Empowered Vulnerability Repair for Real-World Smart Contracts},
author = {Che Wang and Jiashuo Zhang and Jianbo Gao and Libin Xia and Zhi Guan and Zhong Chen},
booktitle = {ASE},
year = {2024},
doi = {10.1145/3691620.3695349}
}