Two Timin':采用双层方法修复智能合约
Two Timin': Repairing Smart Contracts With A Two-Layered Approach
AI总结:
本文提出一种双层框架,结合Slither报告、RandomForestClassifier与LLMs,实现智能合约漏洞的自动分类与直接修复,GPT-3.5-Turbo与Llama-2-7B模型分别减少97.5%和96.7%的漏洞且保留原有功能。
摘要:
由于区块链技术的现代相关性,智能合约同时带来了巨大的风险和收益。其中的漏洞可能引发连锁反应,导致重大损失。许多当前的论文主要集中在通过有限的合约特征(如字节码或操作码)对智能合约进行恶意意图分类。本文提出了一种新颖的双层框架:1)分类和 2)直接修复恶意合约。Slither 的漏洞报告与源代码结合,通过预训练的 RandomForestClassifier (RFC) 和 Large Language Models (LLMs) 进行处理,对每个建议的漏洞进行分类和修复。实验证明了微调和提示工程 LLMs 的有效性。由预训练 GPT-3.5-Turbo 和微调 Llama-2-7B 模型构建的智能合约修复模型,分别将整体漏洞数量减少了 97.5% 和 96.7%。对修复后合约的人工检查表明,所有合约均保留了功能,这表明所提出的方法适用于智能合约漏洞的自动批量分类和修复。
英文摘要:
Due to the modern relevance of blockchain technology, smart contracts present both substantial risks and benefits. Vulnerabilities within them can trigger a cascade of consequences, resulting in significant losses. Many current papers primarily focus on classifying smart contracts for malicious intent, often relying on limited contract characteristics, such as bytecode or opcode. This paper proposes a novel, two-layered framework: 1) classifying and 2) directly repairing malicious contracts. Slither's vulnerability report is combined with source code and passed through a pre-trained RandomForestClassifier (RFC) and Large Language Models (LLMs), classifying and repairing each suggested vulnerability. Experiments demonstrate the effectiveness of fine-tuned and prompt-engineered LLMs. The smart contract repair models, built from pre-trained GPT-3.5-Turbo and fine-tuned Llama-2-7B models, reduced the overall vulnerability count by 97.5% and 96.7% respectively. A manual inspection of repaired contracts shows that all retain functionality, indicating that the proposed method is appropriate for automatic batch classification and repair of vulnerabilities in smart contracts.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。