Coding agents copy existing vulnerabilities into new code
Original title: Coding Agents Propagate Vulnerabilities in Code Bases
Insecure neighbors cut secure backend implementations 3.4% and widen the C/C++ context gap to 35.4%.
A study tests whether insecure code already in a repository leads LLM coding agents to write similar flaws. On 96 tasks that add a backend beside existing applications, insecure neighbors reduce the share of correct and secure implementations by 3.4% on average. On 20 pairs of memory-safety-critical tasks in real C/C++ projects, the average gap between secure and insecure contexts is 35.4%. Prompts to match existing style increase propagation and security prompts decrease it, but neither stops it. Agents attribute choices to another code site in 76.5% of explanations and recognize the introduced vulnerability in 69.9% of cases.
Unconfirmed: Findings are from the authors’ task sets; no named production code base or live incident is reported.
- The backend study covers 96 tasks that implement a new application beside existing ones.
- The C/C++ study uses 20 task pairs focused on memory-safety-critical code.
- Style-following prompts increase vulnerability propagation; security prompts reduce it.
- Agents cite another code site in 76.5% of explanations and recognize the flaw in 69.9%.
From the original article
1 min read at arxiv.orgLLM-based coding agents are widely used to develop critical production software. Even though coding agents are known to occasionally write vulnerable code, there has not been any investigation into how code base vulnerabilities evolve over time under coding agent contributions.
By Chenhao Sun · arxiv.org
A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.