arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.22293cs.CRcs.SE
收藏

微调LLM以实现代码变异:网络威胁的新纪元

Fine-Tuning LLMs for Code Mutation: A New Era of Cyber Threats

Mohammad Setak, Pooria Madani

AI总结:

本文提出面向预训练LLM代码合成器的代码变异训练定义,并通过子程序级重构与单元测试验证,证明微调轻量级模型可生成多样且功能正确的变异代码。

摘要:

大型语言模型(LLM)的最新进展显著提升了其在自然语言处理和代码合成方面的能力,从而促成了不同领域中更复杂的应用。本文探讨了LLM在代码变异情境下的应用;代码变异是在不改变程序代码功能的情况下改变其结构的过程。传统上,代码变异被用于提高关键任务应用中的软件鲁棒性。此外,恶意软件开发者也利用变异引擎来逃避恶意软件检测系统所采用的基于签名的检测方法。此类威胁行为者经常使用的现有代码变异引擎通常只会在恶意软件中产生有限的变化,这些变化仍可通过静态代码分析识别。然而,基于LLM的代码合成器所展现出的灵活性,可能会显著改变这一威胁格局,因为它允许进行更复杂、且不易通过静态分析检测到的代码变异。人们可以通过微调和再训练来增加预训练LLM合成代码的多样性。我们将这一过程称为代码变异训练。在本文中,我们针对基于预训练LLM的代码合成器提出了一个新颖的代码变异训练定义,并在一个轻量级预训练模型上演示了这种训练。我们的方法涉及在子程序层级对代码进行重构(即变异),这使得变异更可控,同时通过单元测试验证来保持语义完整性。我们的实验结果表明,该方法能够有效提升基于LLM的程序合成器的代码变异能力,使其生成多样化且功能正确的代码解决方案,展现出它们改变代码变异格局及相关威胁的潜力。

英文摘要:

Recent advancements in Large Language Models (LLMs) have significantly improved their capabilities in natural language processing and code synthesis, enabling more complex applications across different fields. This paper explores the application of LLMs in the context of code mutation, a process where the structure of program code is altered without changing its functionality. Traditionally, code mutation has been employed to increase software robustness in mission-critical applications. Additionally, mutation engines have been exploited by malware developers to evade the signature-based detection methods employed by malware detection systems. Existing code mutation engines, often used by such threat actors, typically result in only limited variations in the malware, which can still be identified through static code analysis. However, the agility demonstrated by an LLM-based code synthesizer could significantly change this threat landscape by allowing for more complex code mutations that are not easily detected using static analysis. One can increase variations of codes synthesized by a pre-trained LLM through fine-tuning and retraining. This process is what we refer to as code mutation training. In this paper, we propose a novel definition of code mutation training tailored for pre-trained LLM-based code synthesizers and demonstrate this training on a lightweight pre-trained model. Our approach involves restructuring (i.e., mutating) code at the subroutine level, which allows for more manageable mutations while maintaining the semantic integrity verified through unit testing. Our experimental results illustrate the effectiveness of our approach in improving code mutation capabilities of LLM-based program synthesizers in producing varied and functionally correct code solutions, showcasing their potential to transform the landscape of code mutation and the threats associated with it.

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

↑