用多智能体框架自动修复Solidity和Move代码漏洞
Securing Smart Contract Languages with a Unified Agentic Framework for Vulnerability Repair in Solidity and Move
- 设计多智能体系统,分角色分析代码安全问题
- 在多个漏洞类型上修复率超现有模型,尤其擅长处理Move语言特性
- 无需大量专有数据训练,适合区块链安全开发人员参考
区块链生态快速发展,智能合约锁定价值激增,安全需求迫切。尽管Solidity和Move等语言旨在提升安全性,漏洞仍频繁出现。本文提出Smartify,一种基于大语言模型的多智能体框架,可自动检测并修复Solidity与Move智能合约中的漏洞。不同于依赖海量预训练数据的传统方法,Smartify通过一组专用智能体,在经过特定微调的LLM上,依据编程概念与语言特有安全原则进行代码分析。我们在Solidity数据集和自建Move数据集上评估,结果表明Smartify(Gemma2+codegemma)达到当前最优性能,超越现有LLM并显著提升通用模型(如Llama 3.1)能力。其优势在于可融入语言特异性知识(如Move细节),而无需大规模专属预训练数据。本研究深入分析了不同LLM在漏洞修复中的表现,凸显多智能体方法的优越性,并为构建更安全可靠的去中心化应用提供蓝图,同时给出可扩展至其他场景的实现方案。
原文摘要 · Abstract (English)
The rapid growth of the blockchain ecosystem and the increasing value locked in smart contracts necessitate robust security measures. While languages like Solidity and Move aim to improve smart contract security, vulnerabilities persist. This paper presents Smartify, a novel multi-agent framework leveraging Large Language Models (LLMs) to automatically detect and repair vulnerabilities in Solidity and Move smart contracts. Unlike traditional methods that rely solely on vast pre-training datasets, Smartify employs a team of specialized agents working on different specially fine-tuned LLMs to analyze code based on underlying programming concepts and language-specific security principles. We evaluated Smartify on a dataset for Solidity and a curated dataset for Move, demonstrating its effectiveness in fixing a wide range of vulnerabilities. Our results show that Smartify (Gemma2+codegemma) achieves state-of-the-art performance, surpassing existing LLMs and enhancing general-purpose models' capabilities, such as Llama 3.1. Notably, Smartify can incorporate language-specific knowledge, such as the nuances of Move, without requiring massive language-specific pre-training datasets. This work offers a detailed analysis of various LLMs' performance on smart contract repair, highlighting the strengths of our multi-agent approach and providing a blueprint for developing more secure and reliable decentralized applications in the growing blockchain landscape. We also provide a detailed recipe for extending this to other similar use cases.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。