{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/autosafecoder-a-multi-agent-framework-for","title":"AutoSafeCoder: A Multi-Agent Framework for Securing LLM Code Generation through Static Analysis and Fuzz Testing","arxiv_id":"2409.10737","date":"2024-09-16","proceeding":null,"authors":["Ana Nunez","Nafis Tanveer Islam","Sumit Kumar Jha","Peyman Najafirad"],"abstract":"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.","url_abs":"https://arxiv.org/abs/2409.10737v2","url_pdf":"https://arxiv.org/pdf/2409.10737v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"autosafecoder-a-multi-agent-framework-for","repo_url":"https://github.com/secureaiautonomylab/autosafecoder","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":null}],"tasks":[{"task_slug":"code-generation","task_name":"Code Generation"},{"task_slug":"program-synthesis","task_name":"Program Synthesis"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2409.10737","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2409.10737"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/secureaiautonomylab/autosafecoder","reach":null}],"summary":{"ran_draft_wrong":1,"ran_violates":1,"unverified":3},"by_repo_kind":{"official":{"samples":5,"ran":2,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":5,"samples":[{"code_sha256_prefix":"a7501a1b227fdc9e","entry":"call_chatgpt_analyze_static_security","repo":"secureaiautonomylab/autosafecoder","repo_kind":"official","path":"executor_static.py","file_url":"https://github.com/secureaiautonomylab/autosafecoder/blob/HEAD/executor_static.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a7501a1b227fdc9e"}},{"code_sha256_prefix":"92f398cf14df393b","entry":"preprocess_string","repo":"SecureAIAutonomyLab/AutoSafeCoder","repo_kind":"official","path":"utils.py","file_url":"https://github.com/SecureAIAutonomyLab/AutoSafeCoder/blob/HEAD/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"92f398cf14df393b"}},{"code_sha256_prefix":"a029719412f0bf13","entry":"ExecutorStaticAgent","repo":"secureaiautonomylab/autosafecoder","repo_kind":"official","path":"executor_static.py","file_url":"https://github.com/secureaiautonomylab/autosafecoder/blob/HEAD/executor_static.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a029719412f0bf13"}},{"code_sha256_prefix":"a124cf0819f3d703","entry":"FResult","repo":"secureaiautonomylab/autosafecoder","repo_kind":"official","path":"executor_static.py","file_url":"https://github.com/secureaiautonomylab/autosafecoder/blob/HEAD/executor_static.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a124cf0819f3d703"}},{"code_sha256_prefix":"2391f1cff023ff84","entry":"run_bandit_on_code","repo":"SecureAIAutonomyLab/AutoSafeCoder","repo_kind":"official","path":"eval_bandit.py","file_url":"https://github.com/SecureAIAutonomyLab/AutoSafeCoder/blob/HEAD/eval_bandit.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2391f1cff023ff84"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}