arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2409.10574cs.CRcs.AIcs.ETcs.LG
收藏

让检测变得简单:大型语言模型在 Solidity 漏洞检测中的潜力

Detection Made Easy: Potentials of Large Language Models for Solidity Vulnerabilities

Indian Institute of Technology Patna(印度理工学院巴特那分校)

Md Tauseef Alam, Raju Halder, Abyayananda Maiti

AI总结:

本文研究 LLM 检测 Solidity 智能合约 OWASP 漏洞的能力,构建 VulSmart 数据集并提出 SmartVD 框架,结合多种提示策略与自动化、人工评估,证明其可优于开源及部分闭源模型。

摘要:

近年来,Solidity 智能合约在以太坊主网上的大规模部署,越来越多地吸引了受经济利益驱动的攻击者。以太坊历史上几起如今臭名昭著的攻击包括:2016 年的 DAO 攻击(损失 5000 万美元)、2017 年的 Parity Wallet 黑客攻击(1.46 亿美元被锁定)、2018 年 Beautychain 的代币 BEC(9 亿美元市值归零),以及 2022 年的 NFT 游戏区块链入侵事件(价值 6 亿美元的 Ether 被盗)。本文对使用大型语言模型(LLM)检测 Solidity 中 OWASP 十大漏洞的能力进行了全面研究。我们引入了一个新颖、类别平衡、结构化且带标签的数据集,名为 VulSmart,并用它对 CodeLlama、Llama2、CodeT5 和 Falcon 等开源 LLM,以及 GPT-3.5 Turbo 和 GPT-4o Mini 等闭源模型的性能进行基准测试和比较。我们提出的 SmartVD 框架通过广泛的自动化和人工评估,针对这些模型接受了严格测试,并使用 BLEU 和 ROUGE 指标评估智能合约漏洞检测的有效性。我们还探索了三种不同的提示策略——zero-shot、few-shot 和 chain-of-thought——以评估 SmartVD 框架的多类别分类和生成能力。研究结果表明,SmartVD 优于其开源同类模型,甚至超过 GPT-3.5 和 GPT-4 Mini 等闭源基础模型的性能。经过微调后,闭源模型 GPT-3.5 Turbo 和 GPT-4o Mini 取得了显著性能:检测漏洞的准确率为 99%,识别漏洞类型的准确率为 94%,判定严重程度的准确率为 98%。值得注意的是,SmartVD 在使用 chain-of-thought 提示技术时表现最佳,而经过微调的闭源模型则在 zero-shot 提示方法下表现优异。

英文摘要:

The large-scale deployment of Solidity smart contracts on the Ethereum mainnet has increasingly attracted financially-motivated attackers in recent years. A few now-infamous attacks in Ethereum's history includes DAO attack in 2016 (50 million dollars lost), Parity Wallet hack in 2017 (146 million dollars locked), Beautychain's token BEC in 2018 (900 million dollars market value fell to 0), and NFT gaming blockchain breach in 2022 ($600 million in Ether stolen). This paper presents a comprehensive investigation of the use of large language models (LLMs) and their capabilities in detecting OWASP Top Ten vulnerabilities in Solidity. We introduce a novel, class-balanced, structured, and labeled dataset named VulSmart, which we use to benchmark and compare the performance of open-source LLMs such as CodeLlama, Llama2, CodeT5 and Falcon, alongside closed-source models like GPT-3.5 Turbo and GPT-4o Mini. Our proposed SmartVD framework is rigorously tested against these models through extensive automated and manual evaluations, utilizing BLEU and ROUGE metrics to assess the effectiveness of vulnerability detection in smart contracts. We also explore three distinct prompting strategies-zero-shot, few-shot, and chain-of-thought-to evaluate the multi-class classification and generative capabilities of the SmartVD framework. Our findings reveal that SmartVD outperforms its open-source counterparts and even exceeds the performance of closed-source base models like GPT-3.5 and GPT-4 Mini. After fine-tuning, the closed-source models, GPT-3.5 Turbo and GPT-4o Mini, achieved remarkable performance with 99% accuracy in detecting vulnerabilities, 94% in identifying their types, and 98% in determining severity. Notably, SmartVD performs best with the `chain-of-thought' prompting technique, whereas the fine-tuned closed-source models excel with the `zero-shot' prompting approach.

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

↑