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

评估LLM生成的智能合约漏洞图景

Evaluating the Vulnerability Landscape of LLM-Generated Smart Contracts

Deakin University(迪肯大学)

Hoang Long Do, Nasrin Sohrabi, Muneeb Ul Hassan

AI总结:

本研究评估了LLM生成的智能合约的安全性,发现其存在严重漏洞,提出缓解措施和开发指南以提高区块链安全。

摘要:

大型语言模型(LLMs)已被广泛应用于现代软件开发生命周期中,用于自动化和协助代码生成,显著提高了开发人员的生产率并减少了开发时间。在区块链领域,开发人员越来越多地依赖LLMs来生成和维护智能合约,这些是去中心化应用的不可变、自动执行组件。由于部署的智能合约不能修改,正确性和安全性至关重要,尤其是在金融和治理等高风险领域。尽管这种依赖性日益增长,但LLM生成的智能合约的安全影响仍不够了解。在本工作中,我们对由最新LLMs(包括ChatGPT、Gemini和Sonnet)生成的Solidity智能合约进行了系统的安全分析,评估这些合约对已知的智能合约漏洞的响应,以评估其在生产环境中的适用性。我们的广泛实验研究显示,尽管这些合约在语法正确性和功能完整性方面表现良好,但LLM生成的智能合约经常表现出严重的安全漏洞,这些漏洞可能在现实世界中被利用。我们进一步分析并分类这些漏洞,识别出不同模型中反复出现的弱点模式。最后,我们讨论了实际的缓解措施和开发指南,以帮助缓解这些风险,为开发人员和研究人员提供可行的见解。我们的发现旨在支持LLMs安全地整合到智能合约开发流程中,并加强区块链生态系统对未来安全故障的抵抗力。

英文摘要:

Large language models (LLMs) have been widely adopted in modern software development lifecycles, where they are increasingly used to automate and assist code generation, significantly improving developer productivity and reducing development time. In the blockchain domain, developers increasingly rely on LLMs to generate and maintain smart contracts, the immutable, self-executing components of decentralized applications. Because deployed smart contracts cannot be modified, correctness and security are paramount, particularly in high-stakes domains such as finance and governance. Despite this growing reliance, the security implications of LLM-generated smart contracts remain insufficiently understood. In this work, we conduct a systematic security analysis of Solidity smart contracts generated by state-of-the-art LLMs, including ChatGPT, Gemini, and Sonnet. We evaluate these contracts against a broad set of known smart contract vulnerabilities to assess their suitability for direct deployment in production environments. Our extensive experimental study shows that, despite their syntactic correctness and functional completeness, LLM-generated smart contracts frequently exhibit severe security flaws that could be exploited in real-world settings. We further analyze and categorize these vulnerabilities, identifying recurring weakness patterns across different models. Finally, we discuss practical countermeasures and development guidelines to help mitigate these risks, offering actionable insights for both developers and researchers. Our findings aim to support safe integration of LLMs into smart contract development workflows and to strengthen the overall security of the blockchain ecosystem against future security failures.

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

↑