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

利用大语言模型与机器学习进行智能合约漏洞检测

Leveraging Large Language Models and Machine Learning for Smart Contract Vulnerability Detection

S M Mostaq Hossain, Amani Altarawneh, Jesse Roberts

AI总结:

本文研究利用微调大语言模型与传统机器学习算法对智能合约漏洞进行分类检测,实验表明微调LLM准确率超过90%,优于其他模型,为区块链安全提供了更有效的可解释检测框架。

摘要:

随着区块链技术和智能合约被广泛采用,在交易过程的每个阶段保障其安全性至关重要。提升智能合约安全性的核心关切在于利用经典机器学习(ML)模型和微调后的大语言模型(LLM)来发现和检测漏洞。此类工作的稳健性依赖于一个带标注的智能合约数据集,该数据集包含已标注的漏洞,并在其上训练和测试了多个LLM以及多种传统机器学习算法,例如DistilBERT模型。我们训练并测试机器学习算法,根据漏洞类型对智能合约代码进行分类,以比较模型性能。专门针对智能合约代码分类对LLM进行微调,应有助于在检测多种众所周知的漏洞类型时取得更好的结果,例如Reentrancy、Integer Overflow、Timestamp Dependency和Dangerous Delegatecall。从我们的初步实验结果可以看出,我们微调后的LLM以超过90%的准确率超越了其他任何模型的准确率,这推进了现有的漏洞检测基准。这种性能为LLM能够描述传统机器学习模型可能遗漏的代码中的细微模式提供了大量证据。因此,我们比较了每个ML和LLM模型,以全面概述每个模型的优势,从而能够为智能合约安全中的实际应用选择最有效的模型。我们的研究结合了机器学习和大语言模型,为检测不同的智能合约漏洞提供了一个丰富且可解释的框架,为更安全的区块链生态系统奠定了基础。

英文摘要:

As blockchain technology and smart contracts become widely adopted, securing them throughout every stage of the transaction process is essential. The concern of improved security for smart contracts is to find and detect vulnerabilities using classical Machine Learning (ML) models and fine-tuned Large Language Models (LLM). The robustness of such work rests on a labeled smart contract dataset that includes annotated vulnerabilities on which several LLMs alongside various traditional machine learning algorithms such as DistilBERT model is trained and tested. We train and test machine learning algorithms to classify smart contract codes according to vulnerability types in order to compare model performance. Having fine-tuned the LLMs specifically for smart contract code classification should help in getting better results when detecting several types of well-known vulnerabilities, such as Reentrancy, Integer Overflow, Timestamp Dependency and Dangerous Delegatecall. From our initial experimental results, it can be seen that our fine-tuned LLM surpasses the accuracy of any other model by achieving an accuracy of over 90%, and this advances the existing vulnerability detection benchmarks. Such performance provides a great deal of evidence for LLMs ability to describe the subtle patterns in the code that traditional ML models could miss. Thus, we compared each of the ML and LLM models to give a good overview of each models strengths, from which we can choose the most effective one for real-world applications in smart contract security. Our research combines machine learning and large language models to provide a rich and interpretable framework for detecting different smart contract vulnerabilities, which lays a foundation for a more secure blockchain ecosystem.

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

↑