AutoSafeCoder:通过静态分析和模糊测试保障LLM代码生成安全的多智能体框架
AutoSafeCoder: A Multi-Agent Framework for Securing LLM Code Generation through Static Analysis and Fuzz Testing
AI总结:
AutoSafeCoder提出多智能体框架,通过编码、静态分析和模糊测试智能体协作,在代码生成中迭代集成动态与静态测试,使漏洞减少13%且不影响功能。
摘要:
近年来,利用大型语言模型(LLM)进行自动代码生成的进展使我们更接近完全自动化的安全软件开发。然而,现有方法通常依赖单一智能体进行代码生成,难以生成安全、无漏洞的代码。传统的基于LLM的程序合成主要关注功能正确性,往往忽视了运行时发生的关键动态安全影响。为解决这些问题,我们提出了AutoSafeCoder,一个多智能体框架,利用LLM驱动的智能体通过持续协作进行代码生成、漏洞分析和安全增强。该框架由三个智能体组成:负责代码生成的编码智能体、识别漏洞的静态分析智能体,以及使用基于变异的模糊测试方法进行动态测试以检测运行时错误的模糊测试智能体。我们的贡献在于通过将动态和静态测试集成到LLM代码生成的迭代过程中,确保多智能体代码生成的安全性,从而提高安全性。使用SecurityEval数据集的实验表明,与基线LLM相比,代码漏洞减少了13%,且功能未受影响。
英文摘要:
Recent advancements in automatic code generation using large language models (LLMs) have brought us closer to fully automated secure software development. However, existing approaches often rely on a single agent for code generation, which struggles to produce secure, vulnerability-free code. Traditional program synthesis with LLMs has primarily focused on functional correctness, often neglecting critical dynamic security implications that happen during runtime. To address these challenges, we propose AutoSafeCoder, a multi-agent framework that leverages LLM-driven agents for code generation, vulnerability analysis, and security enhancement through continuous collaboration. The framework consists of three agents: a Coding Agent responsible for code generation, a Static Analyzer Agent identifying vulnerabilities, and a Fuzzing Agent performing dynamic testing using a mutation-based fuzzing approach to detect runtime errors. Our contribution focuses on ensuring the safety of multi-agent code generation by integrating dynamic and static testing in an iterative process during code generation by LLM that improves security. Experiments using the SecurityEval dataset demonstrate a 13% reduction in code vulnerabilities compared to baseline LLMs, with no compromise in functionality.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。