文章背景与核心概要
评估智能合约漏洞检测工具需要具有已知真实标签(Ground Truth)的数据集,然而这类数据集在行业中极为稀缺且难以通过人工构建。本文提出了一种利用大语言模型(LLMs)将漏洞自动注入 Solidity 智能合约的方法,并通过针对 OpenSCV 中 49 种漏洞类型的案例研究进行了验证。该流程通过编译、执行、业务逻辑检查和漏洞验证等多步骤管道对注入后的合约进行验证。
将其应用于 SmartBugs 中的真实世界合约时,LLM 生成了近 1,000 个候选变体,最终筛选出覆盖 25 种漏洞类型的 32 个确认含有漏洞的合约(存活率为 16.58%)。研究指出了诸如 LLM 非确定性以及保持合约语义等实际挑战,并随后利用经过验证的数据集对三个静态分析器进行了基准测试,揭示了它们互补且不完整的覆盖特性。该研究证明了基于 LLM 的漏洞注入方案的可行性,同时也暴露出其在可扩展性和多样性方面的关键局限性。
Automated Vulnerability Injection in Smart Contracts Using Large Language Models
Summary
Assessing vulnerability detection tools for smart contracts requires datasets with known ground truth, yet such datasets are scarce and difficult to build by hand. This paper proposes an automated approach using Large Language Models (LLMs) to inject vulnerabilities into Solidity smart contracts. Tested in a case study targeting 49 vulnerability types from OpenSCV, the pipeline validates injected contracts through compilation, execution, business logic checks, and vulnerability verification. Applied to real-world contracts from SmartBugs, the LLMs generated nearly 1,000 candidate variants, resulting in 32 confirmed vulnerable contracts spanning 25 vulnerability types (a 16.58% survival rate). The study highlights practical challenges such as LLM non-determinism and semantic preservation, and subsequently uses the validated dataset to benchmark three static analyzers, revealing complementary and incomplete coverage profiles.
Assessing vulnerability detection tools for smart contracts requires datasets with known ground truth, yet such datasets are scarce and difficult to build by hand. This paper proposes an automated approach using Large Language Models (LLMs) to inject vulnerabilities into Solidity smart contracts. Tested in a case study targeting 49 vulnerability types from OpenSCV, the pipeline validates injected contracts through compilation, execution, business logic checks, and vulnerability verification. Applied to real-world contracts from SmartBugs, the LLMs generated nearly 1,000 candidate variants, resulting in 32 confirmed vulnerable contracts spanning 25 vulnerability types (a 16.58% survival rate). The study highlights practical challenges such as LLM non-determinism and semantic preservation, and subsequently uses the validated dataset to benchmark three static analyzers, revealing complementary and incomplete coverage profiles.
Document Metadata
| 字段 | 详情 |
|---|---|
| arXiv ID | 2609.02624 |
| 主分类 | 软件工程 (cs.SE) |
| 次分类 | 人工智能 (cs.AI), 密码学与安全 (cs.CR) |
| 提交日期 | 2026年9月2日 |
| DOI | 10.48550/arXiv.2609.02624 |
| 许可证 | 知识共享署名 4.0 国际版 ![]() |
Field Details arXiv ID 2609.02624Primary Subject Software Engineering ( cs.SE)Secondary Subjects Artificial Intelligence ( cs.AI), Cryptography and Security (cs.CR)Submission Date September 2, 2026 DOI 10.48550/arXiv.2609.02624 License Creative Commons Attribution 4.0 International
作者
- Luca Migliaccio
- Roberto Natella
- Naghmeh Ivaki
- Nuno Laranjeiro
- Marco Vieira
Authors
- Luca Migliaccio
- Roberto Natella
- Naghmeh Ivaki
- Nuno Laranjeiro
- Marco Vieira
摘要
评估智能合约漏洞检测工具需要具有已知真实标签的数据集,然而这类数据集稀缺且难以通过人工构建。我们提出了一种利用大语言模型(LLMs)将漏洞自动注入 Solidity 智能合约的方法,并在针对 OpenSCV 中 49 种漏洞类型的案例研究中进行了演示。注入后的合约通过一个多步骤的流水线进行验证,该流水线检查编译、执行、业务逻辑以及预期漏洞的存在性。将其应用于 SmartBugs 中的真实合约时,LLM 生成了近 1,000 个候选变体;经过去重和验证后,有 32 个覆盖 25 种漏洞类型的确认漏洞合约存活下来(存活率为 16.58%)。存活的合约主要集中在结构较简单的目标以及具有局部句法模式的漏洞类型中。我们报告了实际面临的挑战,包括 LLM 的非确定性以及保持合约语义的难度。随后,我们使用经过验证的合约来评估三个静态分析器,揭示了它们互补且不完整的覆盖特性。结果表明,基于 LLM 的漏洞注入是可行的,同时也暴露了其在可扩展性和多样性方面的关键局限性。
Abstract
Assessing vulnerability detection tools for smart contracts requires datasets with known ground truth, yet such datasets are scarce and difficult to build by hand. We propose an approach that uses Large Language Models (LLMs) to automatically inject vulnerabilities into Solidity smart contracts, and demonstrate it in a case study targeting 49 vulnerability types from OpenSCV. Injected contracts are validated through a multi-step pipeline checking compilation, execution, business logic, and the presence of the intended vulnerability. Applied to real-world contracts from SmartBugs, LLMs generate nearly 1,000 candidate variants; after deduplication and validation, 32 confirmed vulnerable contracts spanning 25 vulnerability types survive (a 16.58% survival rate). Surviving contracts concentrate in structurally simpler targets and vulnerability types with localized syntactic patterns. We report practical challenges including LLMs' non-determinism and the difficulty of preserving contract semantics. We then use the validated contracts to assess three static analyzers, revealing complementary and incomplete coverage profiles. Results show that LLM-based vulnerability injection is feasible, while exposing key limitations in scalability and diversity.
全文与访问链接
Full-Text & Access Links
- PDF Version: View PDF
- HTML Version: HTML (experimental)
- Source Code: TeX Source
外部参考与引用
External References & Citations
