用定制提示词分析智能合约漏洞,准确率超90%
Tailored Prompts, Targeted Protection: Vulnerability-Specific LLM Analysis for Smart Contracts

- 针对13类漏洞设计专用提示词,结合抽象语法树提取上下文
- 在3.2万份真实代码中实现平均召回率92%(正例)和85%(负例)
- 适合区块链安全检测人员与开发团队快速验证合约风险
区块链上的智能合约因不可篡改性易受各类安全漏洞影响,可能导致重大财务损失。现有检测方法对不同漏洞类型适应性差,且依赖人工编写的专家规则。本文提出一种基于大语言模型的实用化智能合约漏洞检测框架。构建并发布了一个大规模数据集,包含来自15个主流区块链平台、超过3200个真实项目中的31,165个专业标注漏洞实例。该方法通过精确的抽象语法树(AST)上下文提取与漏洞特异性提示设计,为13种常见漏洞类别构建定制化检测器。实验表明,该方法在正例上平均召回率达0.92,在负例上达0.85,证明精心设计的上下文提示在可扩展、高精度的智能合约安全分析中具有巨大潜力。
原文摘要 · Abstract (English)
Smart contracts on blockchains are prone to diverse security vulnerabilities that can lead to significant financial losses due to their immutable nature. Existing detection approaches often lack flexibility across vulnerability types and rely heavily on manually crafted expert rules. In this paper, we present an LLM-based framework for practical smart contract vulnerability detection. We construct and release a large-scale dataset comprising 31,165 professionally annotated vulnerability instances collected from over 3,200 real-world projects across 15 major blockchain platforms. Our approach leverages precise AST-based context extraction and vulnerability-specific prompt design to instantiate customized detectors for 13 prevalent vulnerability categories. Experimental results demonstrate strong effectiveness, achieving an average positive recall of 0.92 and an average negative recall of 0.85, highlighting the potential of carefully engineered contextual prompting for scalable and high-precision smart contract security analysis.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。