The LMVD-ID is an internal research identifier, not an official CVE identifier.
Adversarial Code Generation
Large Language Models (LLMs) used for code generation are vulnerable to adversarial natural language instructions that preserve semantic meaning but induce the generation of functionally correct code containing…
Paper-evaluated models(4)
- Code Llama 7B
- StarChat 15B
- WizardCoder 15B
- WizardCoder 3B
Description
Large Language Models (LLMs) used for code generation are vulnerable to adversarial natural language instructions that preserve semantic meaning but induce the generation of functionally correct code containing specific vulnerabilities. The attack leverages a novel algorithm, DeceptPrompt, to generate adversarial prompts that manipulate the LLM's output, resulting in vulnerable code without altering the intended functionality.
Examples
See DeceptPrompt paper for examples demonstrating successful attacks targeting various Common Weakness Enumerations (CWEs) including CWE-20 (Improper Input Validation), CWE-119 (Improper Restriction of Operations within the Bounds of a Memory Buffer), CWE-89 (Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')), CWE-476 (Null Pointer Dereference), and CWE-416 (Use After Free). Specific examples are shown in Figures 2, 4, 5, 6, 7, and 8 within the DeceptPrompt paper.
Impact
Successful exploitation can lead to the generation of vulnerable software applications with security flaws such as buffer overflows, SQL injection, improper input validation, null pointer dereferences, and use-after-free vulnerabilities. This allows attackers to compromise the system's security and potentially gain unauthorized access or control.
Affected Systems
LLM-driven code generation systems using models such as Code Llama, StarCoder, and WizardCoder, and potentially others.
Mitigation Steps
- Improved LLM training data which includes adversarial examples to enhance model robustness.
- Implement robust input sanitization and validation within the generated code.
- Develop and deploy static and dynamic code analysis tools to detect vulnerabilities.
- Regular security audits of the LLM and its generated code.
- Further research on techniques to make LLMs more resistant to adversarial attacks.
Research context and confidence
- Evidence and verification
- Paper-reported; independent reproduction is not documented.
- Primary research source linked.
- Severity
- Not rated by this catalog.
- Source and publication type
- arXiv · Research preprint.
- Peer-review status is not provided by this source.
- Author and publication status
- Author metadata is not stored; see the primary paper.
- Threat model and attacker access
- Black-box model, service, or application access.
- Related deployment categories
- No related deployment category is classified.
- Taxonomy labels only; paper-specific deployment prerequisites are not inferred.
- Affected systems
- LLM-driven code generation systems using models such as Code Llama, StarCoder, and WizardCoder, and potentially others.
Research Paper
Deceptprompt: Exploiting llm-driven code generation via adversarial natural language instructions
Primary source: arXiv. Findings are reported by the cited research and have not been independently verified.
View PaperEvidence
This entry is based on a primary research source. Its findings are paper-reported; independent reproduction and verification are not claimed.
https://arxiv.org/abs/2312.04730Related research
- Automated indirect prompt injection against tool-calling agents
Published June 9, 2026 · application-layer, injection, agent
- Agent Implicit Doc Execution
Published April 1, 2026 · application-layer, prompt-layer, injection
- Agent Skill Injection
Published April 1, 2026 · application-layer, prompt-layer, injection