Acoda:对抗性代码混淆防御基于LLM的分析
Acoda: Adversarial Code Obfuscation for Defending against LLM-based Analysis
AI总结:
提出基于遗传算法的对抗性代码混淆框架Acoda,通过8种语义保留的混淆方法迭代优化,有效诱导LLM拒绝或误判代码分析,在7个先进LLM上攻击成功率高达70%。
摘要:
随着大型语言模型(LLM)在软件工程(SE)任务(如代码理解、调试和漏洞检测)中的广泛采用,其强大的语义推理能力也带来了新的安全和隐私风险。LLM可以分析、重构甚至逆向工程源代码逻辑,可能导致知识产权泄露。为解决这一问题,我们提出了Acoda,一种基于遗传算法的对抗性代码混淆框架,用于防御基于LLM的代码分析。Acoda利用LLM的两个关键机制,即安全对齐和基于令牌的信息处理,设计了8种保留语义的混淆方法。它通过遗传算法迭代优化混淆策略,生成最大化防御效果的对抗样本。此外,我们提出了一种基于LLM响应的定量评估框架,该框架结合辅助LLM和四个评估指标,全面评估目标LLM分析混淆代码的能力。实验结果表明,Acoda能有效诱导LLM拒绝或误判代码分析。在包括GPT-4o、DeepSeek、Qwen、Llama和Gemma在内的7个最先进LLM上,Acoda实现了高达70%的攻击成功率(ASR),具有强大的跨模型迁移性和最小的运行时开销,同时确保原始代码的语义不变。总体而言,本研究为LLM时代的代码保护和LLM安全防御提供了新视角。
英文摘要:
With the widespread adoption of Large Language Models (LLMs) in software engineering (SE) tasks such as code understanding, debugging, and vulnerability detection, their powerful semantic reasoning ability has also introduced new security and privacy risks. LLMs can analyze, reconstruct, or even reverse-engineer source code logic, potentially leading to the leakage of intellectual property. To address this issue, we propose Acoda, a genetic algorithm-based adversarial code obfuscation framework that defends against LLM-based code analysis. Acoda leverages two key mechanisms of LLMs, namely safety alignment and token-based information processing, to design 8 semantics-preserving obfuscation methods. It iteratively optimizes obfuscation strategies through a genetic algorithm to generate adversarial samples that maximize defensive effectiveness. In addition, we propose a quantitative evaluation framework based on LLM responses, which combines an auxiliary LLM and four evaluation metrics to assess how target LLMs analyze obfuscated code comprehensively. Experimental results show that Acoda can effectively induce LLMs to refuse or misinterpret code analysis. On 7 state-of-the-art LLMs, including GPT-4o, DeepSeek, Qwen, Llama, and Gemma, Acoda achieves an attack success rate (ASR) of up to 70%, with strong cross-model transferability and minimal runtime overhead, while ensuring that the semantics of the original code remain unchanged. Overall, this study provides a new perspective for code protection and LLM security defense in the era of LLMs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。