Acoda: Defending against LLM-based code analysis with adversarial code obfuscation
Acoda: Adversarial Code Obfuscation for Defending against LLM-based Analysis
The researchers propose Acoda, an adversarial code obfuscation framework based on genetic algorithms, used to defend against large language model analysis of source code and address the risk of code logic being reverse-engineered and intellectual property leaking. The framework exploits two mechanisms of large language models—safety alignment and token-based information processing—designs 8 semantics-preserving obfuscation methods, and iteratively optimizes obfuscation strategies via genetic algorithms; it also proposes a quantitative evaluation framework combining an auxiliary LLM with four metrics. Experiments show that Acoda can effectively induce large language models to refuse to answer or misread code analysis, with an attack success rate of up to 70% on 7 state-of-the-art models including GPT-4o, DeepSeek, Qwen, Llama, and Gemma, with strong cross-model transferability and low runtime overhead, and without changing the semantics of the original code.