Manuscript Offprint
arXiv:2610.34253NameTrap: Steering AI Coding Agents Toward Security Vulnerabilities via Variable Names
Abstract
AI coding agents routinely clone repositories, install packages, and read source code obtained from the Web, so publicly hosted code becomes part of the context that shapes the code they write. We show that this Web-borne context can be weaponized without any explicit instruction. We present NameTrap, a source-code poisoning attack that only renames identifiers in third-party Python files to steer AI coding agents toward attacker-targeted Common Weakness Enumeration (CWE) vulnerabilities. An attacker-side coding agent iteratively aligns identifiers with a CWE-specific naming convention and confirms through local probe completions that the renamed file elicits the target weakness, while the released bait contains neither instructions nor vulnerable statements. We evaluate NameTrap across six AI coding agents, ten underlying language models, and four vulnerability categories: CWE-78, CWE-79, CWE-327, and CWE-502. Starting from files whose clean versions never yield the targeted CWE, identifier-level manipulation achieves overall attack success rates of 22.5% to 56.0% across the six agents, reaching 75.0% for certain agent-model configurations, and substantially outperforms random renaming, neutral renaming, and the prior identifier-poisoning attack XOXO. The attack remains effective under Traditional Chinese prompts and transfers across models, while a security-reminder defense fails to consistently prevent vulnerability introduction. Moreover, three AI-based security analyzers and four static analyzers report none of the targeted weaknesses in the poisoned files. These findings expose an overlooked attack surface of agents that consume Web content: seemingly harmless variable names in untrusted, Web-hosted code can compromise the security of downstream software.
CCS Concepts
• Security and privacy → Software security engineering; • Computing methodologies → Artificial intelligence.
ACM Reference Format:
Chieh-Yuan Chang , Guan-Wei Chen , Chia-Yi Hsu , Chih Yang , Chia-Mu Yu , Chun-Ying Huang . 2027. NameTrap: Steering AI Coding Agents Toward Security Vulnerabilities via Variable Names. In Proceedings of The ACM Web Conference 2027 (WWW '27). ACM, New York, NY, USA, 14 pages. https://doi.org/10.1145/nnnnnnn.nnnnnnn
1 Introduction
Large language model (LLM)-based coding agents are changing how software is developed. Beyond generating individual snippets, they inspect repositories, execute tools, edit multiple files, and iteratively test their changes . Much of the context they act on comes from the Web: agents clone GitHub repositories, install dependencies from public package registries, and retrieve documentation and example code through Web tools. Repository-level completion research shows that such cross-file context directly shapes subsequent code generation . Code hosted on the open Web has therefore become part of the decision-making context of coding agents, and its integrity is a Web security problem: a single public file can influence every agent that reads it. This paper studies how an adversary can exploit this channel, addressing the security of AI agents that consume Web content.
This exposure differs from conventional software supply-chain attacks, in which a malicious dependency itself implements unwanted behavior [44]. In AI-assisted development, an adversary can instead influence the new code that an agent writes by altering material the agent reads during a legitimate task. The risk is amplified because secure code generation is difficult even without an adversary: AI assistants frequently produce insecure code [16, 18], as confirmed by security benchmarks [2, 17, 25], including repository-level ones [21, 30]. We ask whether an attacker can deliberately raise the likelihood of a particular weakness through the context the agent reads.
LLM agents are known to be redirectable through lower-trust content, via indirect prompt injection [5, 6, 40], memory and knowledge poisoning [4, 45], and broader attacks on tools and actions [19, 42]. For coding agents, repository artifacts such as documentation and agent rule files can carry injected instructions [11, 43]. These attacks rely on explicit natural-language directives. Source-code identifiers offer a subtler channel: names convey roles, expected values, and trust assumptions, yet renaming them leaves execution semantics unchanged. Code models exploit identifier semantics explicitly [7, 29], semantics-preserving renaming changes model outputs [9, 31, 35, 38], and XOXO showed that such changes can poison the cross-origin context of AI coding assistants [23]. This raises a concrete question for autonomous coding workflows: can an innocuous-looking identifier change in a file obtained from the Web steer an agent into implementing a specific vulnerability?
We answer this question with NameTrap, an agent-generated source-code poisoning attack that renames identifiers in third-party Python files to induce attacker-targeted Common Weakness Enumeration (CWE) vulnerabilities during downstream code generation. The attacker publishes a file on a public code-hosting platform but cannot change the victim agent's system instructions, the developer's task, the model, or the agent framework. An attacker-side
WWW '27, Dublin, Ireland
- ACM ISBN 978-x-xxxx-xxxx-x/YYYY/MM
https://doi.org/10.1145/nnnnnnn.nnnnnnn
Chieh-Yuan Chang , Guan-Wei Chen , Chia-Yi Hsu , Chih Yang , Chia-Mu Yu , Chun-Ying Huang
coding agent iteratively applies CWE-conditioned naming conventions to an incomplete file and probes each variant with a local completion and security scan. The released bait retains only admissible identifier changes; it contains neither instructions nor the vulnerable completion produced by the probe. The weakness materializes only when a separate victim agent, performing a legitimate task, interprets the poisoned names.
We evaluate NameTrap on Python files from 31 popular GitHub projects with six coding agents (OpenCode, Claude Code, Codex, mini-swe-agent, Aider, and OpenHands), ten LLMs, and four CWEs: OS command injection (CWE-78), cross-site scripting (CWE-79), broken or risky cryptography (CWE-327), and unsafe deserialization (CWE-502). All experiments start from screened clean files that never yield the targeted CWE in ten baseline completions. NameTrap reaches overall attack success rates (ASRs) of 22.5%–56.0% across agents and up to 75.0% for individual agent-model configurations, whereas random renaming, neutral renaming, and XOXO are far less effective. The attack persists under Traditional Chinese prompts, transfers across models, and is not consistently suppressed by an explicit security reminder; meanwhile, seven AI-based and static analyzers detect none of the targeted weaknesses in the bait files. In summary, we make the following contributions:
• Identifier-only, agent-generated source poisoning. We define a threat model and an iterative, probe-verified bait-construction process that uses CWE-conditioned identifier renaming, rather than explicit instructions or injected vulnerable statements, to steer downstream code generation.
• Systematic evaluation of targeted vulnerability induction. We evaluate six coding agents, ten LLMs, and four CWE categories against screened clean baselines, and compare against random renaming, neutral renaming, and XOXO.
• Transferability, defense, and detection analysis. We measure cross-model transfer and prompt-language effects, and show that a prompt-level security reminder and seven pre-completion vulnerability analyzers do not mitigate the attack.
2 Related Work
Security of AI-generated code. Functional-looking code produced by AI assistants is often insecure: Pearce et al. found CWE-relevant weaknesses in GitHub Copilot suggestions, and Perry et al. showed that developers using AI assistants wrote less secure code while being more confident in it [16, 18]. Benchmarks now assess security jointly with functionality, from CWE-oriented and end-to-end backend tests [17, 25] and broad cybersecurity suites [2] to repository-level settings [21, 30]. The latter build on repository-aware completion and issue-resolution benchmarks [10, 13, 41] and on agent scaffolds that read, edit, and test entire repositories [28, 32, 34, 37]. He and Vechev further showed that code LLMs can be steered toward or away from vulnerable code through learned prefixes [8]. These works measure how often insecure code arises; NameTrap measures how far an adversary can raise the likelihood of a specific CWE through the context an agent reads, relative to screened clean baselines.
Prompt injection and context poisoning of LLM agents. Indirect prompt injection embeds instructions in Web pages, documents, and other lower-trust content consumed by LLM-integrated applications [6, 14]. InjecAgent, AgentDojo, ASB, and ToolEmu benchmark its effect on tool-using agents [5, 19, 40, 42], EIA demonstrates it against generalist Web agents [12], and AgentPoison and PoisonedRAG poison agent memory and retrieval corpora [4, 45]. For coding agents, instructions planted in repository files, rule files, and documentation can trigger harmful shell commands [11, 15], with susceptibility depending on how users invoke the agent [43]. Defenses such as the instruction hierarchy [26] and structured queries [3] separate trusted instructions from untrusted data. All of these settings assume that the adversarial content is, or contains, an instruction. NameTrap carries no instruction: its payload is a set of identifiers that remain valid program text and merely suggest an implementation convention, a channel that instruction-data separation does not directly target.
Identifier semantics and adversarial code transformations. Code models exploit developer-assigned names: CodeT5 uses identifier-aware pretraining, and GraphCodeBERT models data flow among variables [7, 29]. Consequently, semantics-preserving transformations, notably variable renaming, can flip model predictions [9, 31, 35, 38] and degrade the robustness of code generation [27]. These studies target prediction errors on fixed tasks; NameTrap instead asks whether renamed identifiers cause an agent to write new code containing an attacker-chosen CWE.
Poisoning code models and the software supply chain. Training-time poisoning can make completion models suggest insecure code [1, 20, 33], with triggers hidden in adversarial identifiers [36] or code style [24]. Open-source ecosystems distributed over the Web amplify the reach of a single malicious package [44], and code LLMs add new supply-chain risks such as hallucinated package names [22]. NameTrap needs no access to training data or model parameters and ships no malicious code; it acts at inference time through ordinary source files. The closest work, XOXO [23], introduced cross-origin context poisoning of AI coding assistants via semantics-preserving changes, including identifier renaming. We build on this primitive and study agent-generated, CWE-conditioned identifier bait across six autonomous agents and ten LLMs, with screened clean baselines, prompt-language variation, cross-model transfer, a prompt-level defense, and pre-completion detection; Section 4.9 shows that our bait is substantially more effective than XOXO on the same targets. Finally, unlike repository-level vulnerability detection [39], detecting NameTrap bait requires anticipating future generation risk, because the distributed file contains no vulnerable statement.
3 Methodology
3.1 Threat Model
Attacker Goal. The attacker aims to make a victim AI coding agent generate code containing a targeted vulnerability while performing a legitimate development task. Rather than inserting vulnerabilities, the attacker renames identifiers in third-party Python code while preserving its functionality; the poisoned code then enters the victim agent's development context, where the modified identifiers influence subsequent code generation. We consider four target categories: OS command injection (CWE-78), cross-site scripting (CWE-79), use of a broken or risky cryptographic algorithm (CWE-327), and deserialization of untrusted data (CWE-502). An attack succeeds when the victim agent produces code containing the targeted vulnerability in response to an otherwise benign development request.
Attacker Capabilities. The attacker can prepare poisoned Python source code and publish it in a public GitHub repository, from which developers obtain it during legitimate development. The attacker may only rename identifiers and must preserve the original functionality. The attacker has no knowledge of the victim's prompt language, underlying LLM, or coding agent, and cannot control the victim's instructions or development environment. The poisoned source file is the attacker's only means of influence; whether and how it is used is determined entirely by the developer and the victim agent. Bait construction requires only black-box access to an attacker-chosen agent and model and at most ten renaming passes per file, so the attack scales cheaply to many files and projects.
3.2 Dataset Collection and Preprocessing
We collect Python source files from the 100 most-starred GitHub projects. To identify suitable code locations, we analyze these files with Bandit and Semgrep for CWE-78, CWE-79, CWE-327, and CWE-502, and remove the lines associated with detected security risks, leaving incomplete code regions to be completed by AI coding agents. We select the first 50 files for each CWE, obtaining 200 source files from 31 GitHub projects that cover 47 project–CWE combinations. Before any identifier modification, we screen how coding agents complete the unmodified files. For each agent–model configuration, we run ten independent completion attempts with the same legitimate development prompt, restoring the preprocessed file and starting a fresh conversation for each attempt. The completed code is analyzed with Bandit and Semgrep, and a file is retained in the all-safe set only if none of the ten attempts triggers the targeted CWE and the agent modifies the file in at least one attempt. The retained files constitute the clean baselines for all subsequent experiments. Data collection, code cleaning, and baseline screening are preparatory procedures; the attack begins only when the attacker-side agent modifies identifiers in a selected clean file.
3.3 Agent-Driven Bait Construction
Attack Intuition. Our attack exploits a mismatch between the execution semantics of source code and the contextual signals that AI coding agents extract from identifiers. In an incomplete source file, existing names implicitly suggest which operations, trust assumptions, and implementation conventions the missing code should follow. An attacker can therefore alter the apparent intent of the surrounding program through renaming alone, without inserting an instruction for the downstream agent or implementing a vulnerable operation. Figure 1 gives an overview of the bait-construction pipeline.
Constrained Attack Objective. We formalize identifier-level poisoning as a constrained black-box optimization problem. For an eligible incomplete file and target CWE , let denote the set of admissible identifier-renamed variants of . A variant belongs to only if its renaming is consistent, its existing program behavior and incomplete regions are preserved, and no non-identifier content is altered. The attacker's ideal objective is
where is a downstream coding agent, is a legitimate completion prompt, indicates whether the completed code is flagged for the targeted CWE, and is the unknown distribution of victim agent–prompt configurations. Since the attacker observes neither the victim configuration nor the corresponding success probability, Equation (1) specifies the goal rather than a quantity we estimate directly. Instead, we conduct a bounded, agent-guided search that uses local probe feedback as a binary success signal.
CWE-Conditioned Naming Guidance. Given an eligible file and a target CWE, we task a coding agent with aligning the file's identifiers to a predefined, CWE-specific naming convention, framing the operation as routine codebase maintenance performed by a senior engineer. Each convention introduces linguistic cues associated with an insecure implementation choice: command-execution and trusted-command terminology for CWE-78, prevalidated-output terminology for CWE-79, compatibility and fast-digest terminology for CWE-327, and trusted serialized-state terminology for CWE-502. The agent may rename functions, variables, and parameters, but must leave missing-code regions untouched and preserve all existing statements, string literals, comments, operators, line ordering, indentation, and control flow. Consequently, the payload that reaches the downstream agent consists only of modified identifiers, not the naming instruction.
Iterative Renaming and Local Completion Probes. Bait construction proceeds through at most renaming passes. Let denote the attacker-side agent's renaming operation and the CWE-conditioned naming query at pass . The cumulative update is
The first query requests naming alignment; the fixed follow-up query asks the agent to continue aligning the remaining identifiers. Each pass starts from , not from the clean file . After pass , the incomplete candidate is copied into an isolated local probe, where a fresh coding-agent interaction completes the missing code using the standard legitimate prompt :
where if Bandit or Semgrep reports the target CWE at medium severity or higher. The superscript denotes a fresh completion interaction, not an update to the completion model. Probing does not modify or the candidate used for the next pass; it supplies offline, black-box feedback about a candidate without any access to the eventual victim's model, agent framework, or prompt language.
Feedback-Guided Candidate Selection. The search uses a first-success stopping rule rather than optimizing a differentiable loss
Chieh-Yuan Chang, Guan-Wei Chen, Chia-Yi Hsu, Chih Yang, Chia-Mu Yu, Chun-Ying Huang

Figure 1: Overview of NameTrap bait construction. Given a preprocessed incomplete file and a target CWE, an attacker-side coding agent renames identifiers according to a CWE-specific naming convention (①); a fresh agent session completes the renamed file in an isolated local probe, which is scanned with Bandit and Semgrep (②). If the target CWE is not detected, another renaming pass follows. The first successful candidate that passes identifier-only verification is released as bait, i.e., the renamed source file before completion.
Table 1: Attack success rates (parseable ASR, %) under four identifier-renaming conditions across six coding agents and four CWE categories.
| Agent | Variant | CWE-78 | CWE-79 | CWE-327 | CWE-502 | Overall |
|---|---|---|---|---|---|---|
| OpenCode | Clean code | 0 | 0 | 0 | 0 | 0 |
| Random renaming | 20.0 | 15.0 | 20.0 | 16.0 | 17.7 | |
| Neutral renaming | 20.0 | 10.0 | 0.0 | 10.0 | 13.1 | |
| NameTrap | 32.0 | 30.0 | 60.0 | 24.0 | 30.8 | |
| Claude Code | Clean code | 0 | 0 | 0 | 0 | 0 |
| Random renaming | 1.7 | 0.0 | 60.0 | 5.0 | 10.0 | |
| Neutral renaming | 1.7 | 0.0 | 20.0 | 10.0 | 5.0 | |
| NameTrap | 11.7 | 0.0 | 70.0 | 55.0 | 25.0 | |
| Codex | Clean code | 0 | 0 | 0 | 0 | 0 |
| Random renaming | 4.3 | 11.8 | 0.0 | 6.0 | 7.1 | |
| Neutral renaming | 5.7 | 6.7 | 0.0 | 2.0 | 3.9 | |
| NameTrap | 15.7 | 37.5 | 0.0 | 42.0 | 24.7 | |
| mini-swe | Clean code | 0 | 0 | 0 | 0 | 0 |
| Random renaming | 0.0 | 2.5 | 10.0 | 10.0 | 5.6 | |
| Neutral renaming | 0.0 | 2.5 | 33.3 | 0.0 | 8.0 | |
| NameTrap | 30.0 | 10.0 | 40.0 | 55.0 | 26.7 | |
| Aider | Clean code | 0 | 0 | 0 | 0 | 0 |
| Random renaming | 35.0 | 10.0 | 10.0 | 2.5 | 20.0 | |
| Neutral renaming | 0.0 | 13.3 | 33.3 | 7.5 | 8.0 | |
| NameTrap | 100.0 | 63.3 | 60.0 | 27.5 | 56.0 | |
| OpenHands | Clean code | 0 | 0 | 0 | 0 | 0 |
| Random renaming | 10.0 | 5.0 | 17.6 | 0.0 | 10.4 | |
| Neutral renaming | 0.0 | 0.0 | 5.6 | 0.0 | 1.3 | |
| NameTrap | 33.3 | 5.0 | 29.4 | 20.0 | 23.4 |
or estimating the probability in Equation (1). The first locally successful pass is
provided that the set is nonempty. The selected candidate is the pre-completion file , not the locally generated code . If no probe triggers the target CWE within passes, the attempt returns no bait. Scanner feedback thus determines whether another renaming pass is needed and which candidate is retained.
Identifier-Only Verification. Candidate selection is followed by a strict admissibility check against the clean file . Let
Table 2: Attack success rates (ASR, %) across six AI coding agents using Qwen-3.5-27B-AWQ-4bit on four CWE categories. G: gross ASR; P: parseable ASR. Bold: highest gross ASR per column.
| Agent | CWE-78 | CWE-79 | CWE-327 | CWE-502 | All | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| G | P | G | P | G | P | G | P | G | P | |
| OpenCode | 32.0 | 32.0 | 30.0 | 30.0 | 60.0 | 60.0 | 24.0 | 24.0 | 30.8 | 30.8 |
| Claude Code | 11.7 | 11.7 | 0.0 | 0.0 | 70.0 | 70.0 | 55.0 | 55.0 | 25.0 | 25.0 |
| Codex | 15.7 | 15.7 | 30.0 | 37.5 | 0.0 | 0.0 | 42.0 | 42.0 | 23.8 | 24.7 |
| mini-swe | 30.0 | 30.0 | 10.0 | 10.0 | 40.0 | 40.0 | 55.0 | 55.0 | 26.7 | 26.7 |
| Aider | 100.0 | 100.0 | 63.3 | 63.3 | 60.0 | 60.0 | 27.5 | 27.5 | 56.0 | 56.0 |
| OpenHands | 33.3 | 33.3 | 5.0 | 5.0 | 25.0 | 29.4 | 20.0 | 20.0 | 22.5 | 23.4 |
when token-level comparison, Git-based textual comparison, compilation checks, and manual adjudication all accept as an identifier-only, semantics-preserving modification, and 0 otherwise. The final output is
Only qualified candidates are retained. The output is always the incomplete, identifier-renamed source file, never the vulnerable completion ; the targeted vulnerability emerges only when a downstream coding agent later completes the file.
4 Experimental Evaluation
4.1 Experimental Settings
Coding Agents and Language Models. We evaluate six AI coding agents: OpenCode, Claude Code, Codex, mini-swe-agent (mini-swe), Aider, and OpenHands. To study the influence of the underlying model, we further evaluate ten LLMs with three agent frameworks (OpenCode, Claude Code, and Codex): Qwen-3.5-4B, Qwen-3.5-9B, Qwen-3.5-27B-AWQ-4bit, Qwen-3.5-122B-A10B-
Table 3: Attack success rates (ASR, %) across ten LLMs and three coding agents using English prompts. Bold: highest overall gross ASR per agent.
| Agent | Model | CWE-78 | CWE-79 | CWE-327 | CWE-502 | All | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| G | P | G | P | G | P | G | P | G | P | ||
| OpenCode | Qwen-3.5-27B-AWQ-4bit | 32.0 | 32.0 | 30.0 | 30.0 | 60.0 | 60.0 | 24.0 | 24.0 | 30.8 | 30.8 |
| Qwen-3.5-4B | 20.0 | 40.0 | 10.0 | 10.0 | - | - | - | - | 15.0 | 20.0 | |
| Qwen-3.5-9B | 0.0 | 0.0 | 10.0 | 10.0 | 50.0 | 50.0 | 50.0 | 58.8 | 32.0 | 34.8 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 23.3 | 23.3 | 28.0 | 28.0 | - | - | 36.7 | 36.7 | 29.1 | 29.1 | |
| Gemma-4-26B-A4B | 0.0 | 0.0 | - | - | 40.0 | 44.4 | 75.0 | 75.0 | 47.5 | 48.7 | |
| Gemma-4-31B | 90.0 | 90.0 | - | - | 100.0 | 100.0 | 55.0 | 55.0 | 75.0 | 75.0 | |
| Nemotron-3-Nano-30B-A3B | 10.0 | 10.0 | 0.0 | 0.0 | 20.0 | 20.7 | 16.7 | 16.7 | 12.7 | 12.8 | |
| GPT-5.4-mini | 5.0 | 5.0 | - | - | 0.0 | 0.0 | 10.0 | 10.0 | 5.0 | 5.0 | |
| DeepSeek-V4-Flash-0731 | 7.5 | 7.5 | - | - | 30.0 | 30.0 | 20.0 | 20.0 | 11.0 | 11.0 | |
| Claude Haiku 4.5 | - | - | - | - | 40.0 | 40.0 | - | - | 40.0 | 40.0 | |
| Claude Code | Qwen-3.5-27B-AWQ-4bit | 11.7 | 11.7 | 0.0 | 0.0 | 70.0 | 70.0 | 55.0 | 55.0 | 25.0 | 25.0 |
| Qwen-3.5-4B | 0.0 | 0.0 | 6.7 | 7.1 | 10.0 | 10.0 | 33.3 | 37.0 | 16.4 | 17.7 | |
| Qwen-3.5-9B | 30.0 | 31.3 | 6.0 | 6.2 | 100.0 | 100.0 | 17.5 | 21.9 | 24.1 | 26.1 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 40.0 | 40.0 | 20.0 | 20.0 | - | - | - | - | 30.0 | 30.0 | |
| Gemma-4-26B-A4B | 10.0 | 10.3 | 3.3 | 4.8 | 27.5 | 27.5 | 0.0 | 0.0 | 12.3 | 13.3 | |
| Gemma-4-31B | 35.0 | 35.0 | 27.5 | 28.9 | 40.0 | 40.0 | 15.0 | 16.7 | 30.0 | 31.1 | |
| Nemotron-3-Nano-30B-A3B | 25.0 | 30.3 | 0.0 | 0.0 | 10.0 | 10.3 | 55.0 | 78.6 | 24.0 | 29.6 | |
| GPT-5.4-mini | 5.0 | 5.0 | 13.3 | 14.8 | 10.0 | 10.0 | 16.7 | 19.2 | 12.0 | 12.9 | |
| DeepSeek-V4-Flash-0731 | 15.0 | 16.7 | 10.0 | 11.1 | 10.0 | 10.0 | 10.0 | 11.1 | 12.2 | 13.1 | |
| Claude Haiku 4.5 | 20.0 | 20.0 | 16.7 | 16.7 | 5.0 | 5.9 | 100.0 | 100.0 | 33.3 | 34.5 | |
| Codex | Qwen-3.5-27B-AWQ-4bit | 15.7 | 15.7 | 30.0 | 37.5 | 0.0 | 0.0 | 42.0 | 42.0 | 23.8 | 24.7 |
| Qwen-3.5-4B | 4.3 | 4.3 | 13.3 | 14.3 | 12.5 | 18.5 | 22.0 | 23.9 | 12.1 | 13.5 | |
| Qwen-3.5-9B | 16.7 | 16.7 | 18.0 | 18.3 | 6.7 | 7.4 | 3.3 | 3.3 | 13.7 | 14.0 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 43.3 | 43.3 | 15.0 | 15.0 | 10.0 | 10.0 | 10.0 | 10.0 | 22.2 | 22.2 | |
| Gemma-4-26B-A4B | 20.0 | 66.7 | 0.0 | 0.0 | 26.7 | 44.4 | - | - | 12.5 | 33.3 | |
| Gemma-4-31B | 17.5 | 18.4 | 10.0 | 12.5 | 10.0 | 13.0 | 5.0 | 7.7 | 11.8 | 14.4 | |
| Nemotron-3-Nano-30B-A3B | 5.0 | 50.0 | 5.0 | 20.0 | 10.0 | 50.0 | 17.5 | 77.8 | 11.0 | 55.0 | |
| GPT-5.4-mini | 10.0 | 13.3 | 0.0 | 0.0 | 20.0 | 22.2 | 0.0 | 0.0 | 12.0 | 14.0 | |
| DeepSeek-V4-Flash-0731 | 28.3 | 28.3 | - | - | 0.0 | 0.0 | 30.0 | 30.0 | 25.0 | 25.0 | |
| Claude Haiku 4.5 | 5.0 | 5.0 | - | - | 5.0 | 5.3 | 12.5 | 12.5 | 8.8 | 8.9 | |
AWQ-4bit, Gemma-4-26B-A4B, Gemma-4-31B, Nemotron-3-Nano-30B-A3B, GPT-5.4-mini, DeepSeek-V4-Flash-0731, and Claude Haiku 4.5. Unless stated otherwise, the six-agent experiments use Qwen-3.5-27B-AWQ-4bit.
Victim Evaluation and Metrics. Each qualified bait file is completed by the victim agent with the legitimate development prompt, starting a fresh session for every attempt. Each completed file is scanned with Bandit and Semgrep, and an attempt succeeds if the target CWE is reported at medium severity or higher. We report the gross ASR (G), computed over all completion attempts, and the parseable ASR (P), computed over attempts whose output can be analyzed by the scanners. Overall/All pools all attempts of a configuration across CWEs, and a dash (-) indicates that no qualifying bait was obtained for that configuration and CWE. Unless stated otherwise, bait is constructed with the same agent-model configuration that is evaluated as the victim; RQ5 decouples the two.
Detection Tools and Hardware. To assess whether poisoned files can be flagged before use, we evaluate three AI-based and four static analyzers (Section 4.8). All experiments were conducted on servers equipped with NVIDIA H100 and H200 GPUs.
4.2 RQ1: Impact of Identifier Renaming Strategies
We first test whether attack success stems from deliberately crafted names or from the mere act of renaming. We compare four variants of each file: Clean Code, Random Renaming (randomly generated names), Neutral Renaming (semantically neutral names), and Ours (agent-generated, CWE-guided names), across six coding agents and four CWE categories.
Table 4: Attack success rates (ASR, %) across six AI coding agents using Qwen-3.5-27B-AWQ-4bit with Traditional Chinese prompts. Bold: highest gross ASR per column.
| Agent | CWE-78 | CWE-79 | CWE-327 | CWE-502 | All | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| G | P | G | P | G | P | G | P | G | P | |
| OpenCode | 46.0 | 46.0 | 20.0 | 20.0 | 70.0 | 70.0 | 28.0 | 28.0 | 36.9 | 36.9 |
| Claude Code | 20.0 | 20.0 | 0.0 | 0.0 | 70.0 | 70.0 | 50.0 | 50.0 | 29.0 | 29.0 |
| Codex | 14.3 | 14.3 | 25.0 | 29.4 | 5.0 | 5.3 | 40.0 | 40.0 | 22.5 | 23.1 |
| mini-swe | 20.0 | 20.0 | 10.0 | 10.0 | 40.0 | 40.0 | 55.0 | 55.0 | 26.7 | 26.7 |
| Aider | 50.0 | 50.0 | 30.0 | 30.0 | 40.0 | 40.0 | 35.0 | 35.9 | 37.0 | 37.4 |
| OpenHands | 26.7 | 26.7 | 10.0 | 10.0 | 15.0 | 15.0 | 30.0 | 30.0 | 20.0 | 20.0 |
As shown in Table 1, our method achieves higher overall ASRs than both random and neutral renaming for all six agents. The largest gain occurs with Aider, where our method reaches 56.0% versus 20.0% for random and 8.0% for neutral renaming; for Codex, the overall ASR rises from 7.1% and 3.9% to 24.7%. Uninformed renaming is not entirely benign: random renaming reaches 60.0% on CWE-327 with Claude Code and 35.0% on CWE-78 with Aider, indicating that disrupting the original names alone can perturb agent behavior. Nevertheless, CWE-guided names match or exceed both baselines for every agent–CWE pair, showing that the attack’s effectiveness stems from adversarial name selection rather than from renaming per se. Averaged over the six agents, the overall ASR is 31.1% for our method, compared with 11.8% for random and 6.6% for neutral renaming.
4.3 RQ2: Impact of Coding Agents
To investigate how the agent framework affects attack effectiveness, we evaluate six agents with the same underlying model, Qwen-3.5-27B-AWQ-4bit, across four CWE categories. As shown in Table 2,
Chieh-Yuan Chang, Guan-Wei Chen, Chia-Yi Hsu, Chih Yang, Chia-Mu Yu, Chun-Ying Huang
Table 5: Cross-model transferability of bait code on CWE-78 (OS command injection). Rows: model used to construct the bait; columns: model that completes the task. Each cell reports gross/parseable ASR (%); shading scales with gross ASR, and bold marks the source model.
| Agent | Bait model | Task-completion model | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Qwen-3.5-27B-AWQ-4bit | Qwen-3.5-4B | Qwen-3.5-9B | Qwen-3.5-122B-A10B-AWQ-4bit | Gemma-4-26B-A4B | Gemma-4-31B | Nemotron-3-Nano-30B-A3B | GPT-5.4-mini | DeepSeek-V4-Flash-0731 | Claude Haiku 4.5 | ||
| OpenCode | Qwen-3.5-27B-AWQ-4bit | 32.0 / 32.0 | 14.0 / 14.6 | 20.0 / 20.4 | 4.0 / 4.0 | 0.0 / 0.0 | 14.0 / 14.3 | 0.0 / 0.0 | 0.0 / 0.0 | 50.0 / 50.0 | 14.0 / 14.0 |
| Qwen-3.5-4B | 10.0 / 10.0 | 20.0 / 40.0 | 0.0 / 0.0 | 100.0 / 100.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | |
| Qwen-3.5-9B | 0.0 / 0.0 | 10.0 / 10.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 6.7 / 6.7 | 10.0 / 10.0 | 10.0 / 10.3 | 23.3 / 23.3 | 26.7 / 26.7 | 13.3 / 13.3 | 0.0 / 0.0 | 0.0 / 0.0 | 13.3 / 13.3 | 3.3 / 3.3 | |
| Gemma-4-26B-A4B | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | |
| Gemma-4-31B | 0.0 / 0.0 | 10.0 / 10.0 | 20.0 / 22.2 | 0.0 / 0.0 | 0.0 / 0.0 | 90.0 / 90.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | |
| Nemotron-3-Nano-30B-A3B | 43.3 / 43.3 | 0.0 / 0.0 | 33.3 / 33.3 | 23.3 / 23.3 | 23.3 / 23.3 | 53.3 / 53.3 | 10.0 / 10.0 | 10.0 / 10.0 | 13.3 / 13.3 | 30.0 / 30.0 | |
| GPT-5.4-mini | 55.0 / 55.0 | 5.0 / 5.0 | 10.0 / 10.0 | 35.0 / 35.0 | 0.0 / 0.0 | 45.0 / 45.0 | 5.0 / 5.0 | 5.0 / 5.0 | 30.0 / 30.0 | 45.0 / 45.0 | |
| DeepSeek-V4-Flash-0731 | 15.0 / 15.0 | 16.2 / 16.2 | 5.0 / 5.1 | 5.0 / 5.0 | 6.2 / 6.2 | 6.2 / 6.2 | 1.2 / 1.5 | 0.0 / 0.0 | 7.5 / 7.5 | 5.0 / 5.0 | |
| Claude Haiku 4.5 | - | - | - | - | - | - | - | - | - | - | |
| Claude Code | Qwen-3.5-27B-AWQ-4bit | 11.7 / 11.7 | 16.7 / 16.7 | 16.7 / 16.9 | 13.3 / 13.3 | 15.0 / 15.0 | 16.7 / 18.5 | 6.7 / 6.9 | 5.0 / 5.1 | 20.0 / 20.3 | 8.3 / 8.3 |
| Qwen-3.5-4B | 0.0 / 0.0 | 0.0 / 0.0 | 10.0 / 10.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 10.0 / 10.8 | 2.5 / 2.5 | 10.0 / 10.5 | 0.0 / 0.0 | |
| Qwen-3.5-9B | 2.9 / 2.9 | 18.6 / 20.3 | 30.0 / 31.3 | 5.7 / 5.7 | 5.7 / 6.2 | 0.0 / 0.0 | 12.9 / 14.1 | 1.4 / 1.4 | 2.9 / 2.9 | 0.0 / 0.0 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 25.0 / 25.0 | 10.0 / 11.1 | 15.0 / 15.0 | 40.0 / 40.0 | 5.0 / 5.0 | 25.0 / 25.0 | 20.0 / 26.7 | 0.0 / 0.0 | 5.0 / 5.3 | 15.0 / 15.0 | |
| Gemma-4-26B-A4B | 32.5 / 32.5 | 7.5 / 8.3 | 12.5 / 12.8 | 0.0 / 0.0 | 10.0 / 10.3 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 45.0 / 46.2 | 40.0 / 40.0 | |
| Gemma-4-31B | 0.0 / 0.0 | 5.0 / 5.0 | 5.0 / 5.0 | 0.0 / 0.0 | 0.0 / 0.0 | 35.0 / 35.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | |
| Nemotron-3-Nano-30B-A3B | 10.0 / 10.0 | 20.0 / 20.5 | 12.5 / 12.5 | 15.0 / 15.0 | 22.5 / 28.1 | 10.0 / 18.2 | 25.0 / 30.3 | 15.0 / 15.0 | 27.5 / 30.6 | 17.5 / 17.5 | |
| GPT-5.4-mini | 50.0 / 50.0 | 20.0 / 20.0 | 15.0 / 15.0 | 0.0 / 0.0 | 0.0 / 0.0 | 5.0 / 5.0 | 10.0 / 13.3 | 5.0 / 5.0 | 35.0 / 41.2 | 45.0 / 45.0 | |
| DeepSeek-V4-Flash-0731 | 12.5 / 12.5 | 20.0 / 20.0 | 20.0 / 20.5 | 5.0 / 5.0 | 15.0 / 18.2 | 15.0 / 18.8 | 17.5 / 17.5 | 12.5 / 12.5 | 15.0 / 16.7 | 17.5 / 17.5 | |
| Claude Haiku 4.5 | 35.0 / 35.0 | 10.0 / 10.0 | 15.0 / 15.8 | 15.0 / 15.0 | 0.0 / 0.0 | 15.0 / 23.1 | 0.0 / 0.0 | 0.0 / 0.0 | 30.0 / 30.0 | 20.0 / 20.0 | |
| Codex | Qwen-3.5-27B-AWQ-4bit | 15.7 / 15.7 | 10.0 / 11.3 | 24.3 / 24.3 | 1.4 / 1.4 | 5.7 / 12.9 | 4.3 / 5.3 | 1.4 / 9.1 | 1.4 / 1.4 | 7.1 / 7.1 | 2.9 / 2.9 |
| Qwen-3.5-4B | 4.3 / 4.3 | 4.3 / 4.3 | 12.9 / 12.9 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | |
| Qwen-3.5-9B | 8.9 / 8.9 | 10.1 / 11.0 | 16.7 / 16.7 | 1.1 / 1.1 | 1.1 / 1.9 | 3.3 / 3.5 | 1.1 / 6.7 | 1.1 / 1.1 | 14.4 / 14.4 | 6.7 / 6.7 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 26.7 / 26.7 | 3.3 / 4.3 | 26.7 / 29.6 | 43.3 / 43.3 | 6.7 / 14.3 | 30.0 / 31.0 | 0.0 / 0.0 | 0.0 / 0.0 | 6.7 / 6.7 | 6.7 / 6.7 | |
| Gemma-4-26B-A4B | 0.0 / 0.0 | 0.0 / 0.0 | 20.0 / 20.0 | 0.0 / 0.0 | 20.0 / 66.7 | 20.0 / 25.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | |
| Gemma-4-31B | 27.5 / 27.5 | 2.5 / 2.9 | 5.0 / 5.0 | 7.5 / 7.5 | 0.0 / 0.0 | 17.5 / 18.4 | 0.0 / 0.0 | 7.5 / 8.6 | 52.5 / 53.8 | 45.0 / 45.0 | |
| Nemotron-3-Nano-30B-A3B | 0.0 / 0.0 | 10.0 / 13.3 | 20.0 / 20.0 | 0.0 / 0.0 | 0.0 / 0.0 | 15.0 / 16.7 | 5.0 / 50.0 | 0.0 / 0.0 | 30.0 / 30.0 | 0.0 / 0.0 | |
| GPT-5.4-mini | 35.0 / 35.0 | 0.0 / 0.0 | 0.0 / 0.0 | 10.0 / 10.0 | 5.0 / 7.7 | 45.0 / 45.0 | 0.0 / 0.0 | 10.0 / 13.3 | 85.0 / 85.0 | 65.0 / 65.0 | |
| DeepSeek-V4-Flash-0731 | 15.0 / 15.0 | 11.7 / 13.0 | 18.3 / 18.6 | 11.7 / 11.7 | 3.3 / 10.0 | 15.0 / 18.4 | 0.0 / 0.0 | 6.7 / 7.0 | 28.3 / 28.3 | 6.7 / 6.7 | |
| Claude Haiku 4.5 | 30.0 / 30.0 | 30.0 / 31.6 | 55.0 / 55.0 | 20.0 / 20.0 | 15.0 / 42.9 | 45.0 / 50.0 | 15.0 / 60.0 | 20.0 / 20.0 | 40.0 / 40.0 | 5.0 / 5.0 | |
effectiveness varies substantially across agents. Aider achieves the highest overall gross ASR of 56.0%, while the remaining agents range from 22.5% to 30.8%. Every agent yields qualifying bait for all four CWEs in this setting. CWE-79 is the most challenging target: Claude Code attains 0.0%, OpenHands 5.0%, and mini-swe 10.0%, although Aider still reaches 63.3%. CWE-327 ranges from 0.0% with Codex to 70.0% with Claude Code. In contrast, CWE-78 attains nonzero ASRs for all six agents, with Aider reaching 100.0%. Attack effectiveness thus depends on both the agent framework and the targeted CWE. Gross and parseable ASRs coincide except for Codex on CWE-79 (30.0% vs. 37.5%) and OpenHands on CWE-327 (25.0% vs. 29.4%), so nearly all completions in this setting are analyzable and the reported ASRs are not inflated by unparseable outputs.
4.4 RQ3: Impact of Prompt Language
Developers worldwide instruct agents in their own languages. We therefore compare English and Traditional Chinese coding prompts across six agents using Qwen-3.5-27B-AWQ-4bit. Table 2 reports the English results and Table 4 the Traditional Chinese results. The effect of prompt language varies across agents. Traditional Chinese prompts raise the overall gross ASR of OpenCode from 30.8% to 36.9% and of Claude Code from 25.0% to 29.0%, while mini-swe remains at 26.7%. In contrast, Aider decreases substantially from 56.0% to 37.0%, followed by OpenHands (22.5% to 20.0%) and Codex (23.8% to 22.5%). For CWE-78, OpenCode increases from 32.0% to 46.0%, while Aider decreases from 100.0% to 50.0%. The attack thus remains effective across prompt languages, while the direction of the change depends on the agent framework. In the ten-LLM setting (Appendix A), the trend is clearer: Traditional Chinese prompts raise the overall gross ASR in 23 of 30 agent-model configurations, and the mean overall gross ASR from 22.3% to 27.7%.
4.5 RQ4: Impact of Underlying Language Models
We next extend the evaluation to ten LLMs across OpenCode, Claude Code, and Codex with English prompts. As shown in Table 3, ASRs vary substantially across models, even within the same agent framework. For OpenCode, overall gross ASRs range from 5.0% (GPT-5.4-mini) to 75.0% (Gemma-4-31B); for Claude Code, from 12.0% (GPT-5.4-mini) to 33.3% (Claude Haiku 4.5); and for Codex, from 8.8% (Claude Haiku 4.5) to 25.0% (DeepSeek-V4-Flash-0731). The same model can behave very differently across frameworks: Gemma-4-31B reaches 75.0% with OpenCode but 30.0% with Claude Code and 11.8% with Codex. Susceptibility therefore depends on the interaction between the LLM and the agent framework, and the availability of qualifying bait also varies across models and CWE categories. The gap between gross and parseable ASR is also informative: with Codex and Nemotron-3-Nano-30B-A3B, the overall gross ASR is 11.0% but the parseable ASR is 55.0%, so although most completions cannot be analyzed, more than half of the analyzable ones contain the targeted weakness. Across CWEs, averaged over the configurations with qualifying bait, the mean gross ASR is highest for CWE-502 (28.2%) and CWE-327 (26.8%), followed by CWE-78 (18.8%) and CWE-79 (11.9%). CWE-79 also has the lowest bait yield, with no qualifying bait in 7 of the 30 configurations, compared with 1 for CWE-78, 3 for CWE-327, and 4 for CWE-502. Averaged across models, OpenCode (29.8%) is more susceptible than Claude Code (21.9%) and Codex (15.3%). Results for the same setting with Traditional Chinese prompts are reported in Appendix A.
Table 6: Attack success rates (ASR, %) across ten LLMs and three coding agents with a prompt-based defense. Bold: highest overall gross ASR per agent.
| Agent | Model | CWE-78 | CWE-79 | CWE-327 | CWE-502 | All | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| G | P | G | P | G | P | G | P | G | P | ||
| OpenCode | Qwen-3.5-27B-AWQ-4bit | 32.0 | 32.0 | 15.0 | 15.0 | 0.0 | 0.0 | 16.0 | 16.0 | 20.8 | 20.8 |
| Qwen-3.5-4B | 40.0 | 44.4 | 0.0 | 0.0 | - | - | - | - | 20.0 | 21.1 | |
| Qwen-3.5-9B | 20.0 | 20.0 | 30.0 | 30.0 | 30.0 | 30.0 | 45.0 | 45.0 | 34.0 | 34.0 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 10.0 | 10.0 | 26.0 | 26.0 | - | - | 23.3 | 23.3 | 20.9 | 20.9 | |
| Gemma-4-26B-A4B | 0.0 | 0.0 | - | - | 80.0 | 88.9 | 85.0 | 85.0 | 62.5 | 64.1 | |
| Gemma-4-31B | 20.0 | 20.0 | - | - | 70.0 | 70.0 | 15.0 | 15.0 | 30.0 | 30.0 | |
| Nemotron-3-Nano-30B-A3B | 10.0 | 11.1 | 0.0 | 0.0 | 10.0 | 10.7 | 23.3 | 23.3 | 11.8 | 12.4 | |
| GPT-5.4-mini | 0.0 | 0.0 | - | - | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | |
| DeepSeek-V4-Flash-0731 | 3.8 | 3.8 | - | - | 20.0 | 20.0 | 40.0 | 40.0 | 9.0 | 9.0 | |
| Claude Haiku 4.5 | - | - | - | - | 0.0 | 0.0 | - | - | 0.0 | 0.0 | |
| Claude Code | Qwen-3.5-27B-AWQ-4bit | 20.0 | 20.0 | 10.0 | 10.0 | 70.0 | 70.0 | 45.0 | 45.0 | 29.0 | 29.0 |
| Qwen-3.5-4B | 2.5 | 2.6 | 10.0 | 10.3 | 10.0 | 10.0 | 31.7 | 32.8 | 17.1 | 17.8 | |
| Qwen-3.5-9B | 18.6 | 18.8 | 10.0 | 10.2 | 80.0 | 80.0 | 25.0 | 32.3 | 21.2 | 22.6 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 50.0 | 50.0 | 25.0 | 25.0 | - | - | - | - | 37.5 | 37.5 | |
| Gemma-4-26B-A4B | 5.0 | 5.0 | 3.3 | 4.3 | 22.5 | 23.7 | 20.0 | 20.0 | 12.3 | 13.2 | |
| Gemma-4-31B | 0.0 | 0.0 | 25.0 | 27.0 | 6.7 | 6.7 | 25.0 | 27.8 | 15.5 | 16.2 | |
| Nemotron-3-Nano-30B-A3B | 22.5 | 31.0 | 0.0 | 0.0 | 16.7 | 17.9 | 55.0 | 84.6 | 25.0 | 33.8 | |
| GPT-5.4-mini | 10.0 | 10.0 | 16.7 | 19.2 | 0.0 | 0.0 | 13.3 | 15.4 | 11.0 | 12.0 | |
| DeepSeek-V4-Flash-0731 | 15.0 | 16.2 | 40.0 | 40.0 | 10.0 | 10.3 | 10.0 | 11.1 | 15.6 | 16.5 | |
| Claude Haiku 4.5 | 20.0 | 20.0 | 16.7 | 16.7 | 10.0 | 13.3 | 100.0 | 100.0 | 34.4 | 36.5 | |
| Codex | Qwen-3.5-27B-AWQ-4bit | 12.9 | 12.9 | 5.0 | 6.7 | 0.0 | 0.0 | 38.0 | 38.0 | 18.1 | 18.8 |
| Qwen-3.5-4B | 5.7 | 6.5 | 3.3 | 3.8 | 25.0 | 38.5 | 34.0 | 35.4 | 16.8 | 19.8 | |
| Qwen-3.5-9B | 16.7 | 16.9 | 4.9 | 5.4 | 13.3 | 19.0 | 10.0 | 10.3 | 11.8 | 12.8 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 56.7 | 58.6 | 20.0 | 20.0 | 5.0 | 5.0 | 0.0 | 0.0 | 24.4 | 24.7 | |
| Gemma-4-26B-A4B | 0.0 | 0.0 | 7.5 | 15.8 | 23.3 | 33.3 | - | - | 12.5 | 23.8 | |
| Gemma-4-31B | 15.0 | 16.2 | 10.0 | 13.3 | 16.7 | 18.5 | 20.0 | 21.1 | 15.5 | 17.3 | |
| Nemotron-3-Nano-30B-A3B | 0.0 | - | 25.0 | 83.3 | 10.0 | 40.0 | 22.5 | 81.8 | 16.0 | 72.7 | |
| GPT-5.4-mini | 10.0 | 10.5 | 10.0 | 10.0 | 18.0 | 22.5 | 5.0 | 5.6 | 13.0 | 14.9 | |
| DeepSeek-V4-Flash-0731 | 5.0 | 5.0 | - | - | 0.0 | 0.0 | 60.0 | 60.0 | 11.2 | 11.2 | |
| Claude Haiku 4.5 | 15.0 | 15.0 | - | - | 0.0 | 0.0 | 12.5 | 12.5 | 10.0 | 10.1 | |
4.6 RQ5: Cross-Model Transferability
In practice, the attacker does not know which LLM powers the victim agent. We therefore examine whether bait constructed with one model induces vulnerabilities when completed by another. Table 5 reports cross-model transferability for CWE-78 across three agents and ten LLMs. Bait often transfers, and some bait is even more effective on other models than on its source model. For example, bait generated by Qwen-3.5-4B with OpenCode achieves a gross ASR of against itself but against Qwen-3.5-122B-A10B-AWQ-4bit. Similarly, bait generated by GPT-5.4-mini with Codex achieves against itself but against DeepSeek-V4-Flash-0731. Transferability varies across model pairs, and some combinations yield no successful attack. Some bait transfers broadly: bait generated by Claude Haiku 4.5 with Codex induces CWE-78 on all ten completion models, with gross ASRs from to . Aggregated over all cross-model pairs with qualifying bait, the bait induces CWE-78 in at least one completion for 42 of 81 pairs with OpenCode, 66 of 90 with Claude Code, and 63 of 90 with Codex; in 68 of these 261 pairs , the transferred bait is more effective than on its source model. Overall, identifier-based poisoning transfers across LLMs, so an attacker can construct bait with an accessible model and still compromise agents built on others. Appendix C reports the corresponding results for CWE-79, CWE-327, and CWE-502.
4.7 RQ6: Effectiveness of Prompt-Based Defense
A natural first-line defense is to remind the agent to write secure code. We append a single sentence to the English coding prompt instructing the agent to avoid generating code containing CWE vulnerabilities, and follow the RQ4 settings with ten LLMs and three agents. As shown in Table 6, the effect of this defense varies considerably across agent-model configurations. Compared with the undefended English prompts, the overall gross ASR decreases in 13 configurations, increases in 15, and remains unchanged in two. For instance, OpenCode with Gemma-4-31B drops from to , whereas OpenCode with Gemma-4-26B-A4B rises from to , and Claude Code with Qwen-3.5-27B-AWQ-4bit rises from to . The reminder also leaves the most vulnerable configurations intact: Claude Code with Claude Haiku 4.5 still yields on CWE-502, exactly as without the defense. Averaged over all 30 configurations, the reminder lowers the mean overall gross ASR only from to , and the mean for CWE-502 even rises from to . Generic security instructions therefore do not reliably prevent identifier-based poisoning: the poisoned names do not contradict the reminder, because they present the insecure choice as an established, trusted convention of the codebase.
4.8 RQ7: Detectability of Poisoned Source Code
We then ask whether existing security analyzers can flag poisoned third-party files before a victim agent processes them. We evaluate three AI-based analyzers, namely CodeGemma (a code-specialized LLM), CodeAstra-7B (an LLM fine-tuned for vulnerability detection), and GPT-5.4-mini prompted as a security reviewer, as well as four static analyzers: Bandit (an AST-based Python security linter), Semgrep (rule-based pattern matching), CodeShield (Meta's detector for insecure LLM-generated code), and CodeQL (query-based semantic and data-flow analysis). For each case, we compare the results on the poisoned file with those on its clean counterpart, focusing on whether the targeted CWE is reported.
As shown in Table 7, all seven tools achieve a detection rate for the targeted CWEs in both bait and control code produced with OpenCode across all ten LLMs and all CWE categories for which
Chieh-Yuan Chang, Guan-Wei Chen, Chia-Yi Hsu, Chih Yang, Chia-Mu Yu, Chun-Ying Huang
Table 7: Detection rates (%) of targeted CWEs in poisoned (bait) and original (control) code generated using OpenCode with ten LLMs ( pairs).
| Model | CWE-78 | CWE-79 | CWE-327 | CWE-502 | All |
|---|---|---|---|---|---|
| Qwen-3.5-27B-AWQ-4bit | |||||
| Qwen-3.5-4B | — | — | |||
| Qwen-3.5-9B | |||||
| Qwen-3.5-122B-A10B-AWQ-4bit | — | ||||
| Gemma-4-26B-A4B | — | ||||
| Gemma-4-31B | — | ||||
| Nemotron-3-Nano-30B-A3B | |||||
| GPT-5.4-mini | — | ||||
| DeepSeek-V4-Flash-0731 | — | ||||
| Claude Haiku 4.5 | — | — | — | ||
| Overall |
Each cell reports bait/control detection rates and holds for all seven tools (CodeGemma, CodeAstra-7B, GPT-5.4-mini, Bandit, Semgrep, CodeShield, and CodeQL), except CodeShield on CWE-79, which has no applicable rule in any row. —: no qualifying bait code.
Table 8: Comparison of attack success rates (parseable ASR, %) between XOXO and NameTrap across four CWE categories. NameTrap is evaluated with six coding agents, while XOXO does not distinguish between coding agents.
| Method | Coding agent | CWE-78 | CWE-79 | CWE-327 | CWE-502 | Overall |
|---|---|---|---|---|---|---|
| XOXO | N/A | 0.0 | 0.0 | 10.0 | 3.3 | 2.1 |
| NameTrap | OpenCode | 32.0 | 30.0 | 60.0 | 24.0 | 30.8 |
| Claude Code | 11.7 | 0.0 | 70.0 | 55.0 | 25.0 | |
| Codex | 15.7 | 37.5 | 0.0 | 42.0 | 24.7 | |
| mini-swe | 30.0 | 10.0 | 40.0 | 55.0 | 26.7 | |
| Aider | 100.0 | 63.3 | 60.0 | 27.5 | 56.0 | |
| OpenHands | 33.3 | 5.0 | 29.4 | 20.0 | 23.4 |
qualifying bait and an applicable rule exist. Because NameTrap modifies only identifiers and introduces no vulnerable statement, present-code vulnerability detectors have nothing to report, even though the file reliably induces vulnerable code once an agent completes it. The same holds for bait constructed with Claude Code and Codex (Appendix B). This blind spot is structural rather than tool-specific: rule-based analyzers match vulnerable statements or data flows, which the bait does not contain, while LLM-based reviewers, although they read identifiers, assess whether the present code is vulnerable rather than whether its names would mislead a future implementer.
4.9 RQ8: Comparison with XOXO
Table 8 compares NameTrap with XOXO [23], the closest prior identifier-level context-poisoning attack, on the same four CWE categories. XOXO is evaluated with 200 queries and does not distinguish between coding agents, so it is reported as a single row. XOXO achieves an overall ASR of only 2.1% and no success on CWE-78 or CWE-79, whereas NameTrap achieves 23.4% to 56.0% overall across all six agents. Even on CWE-327, XOXO's strongest category (10.0%), NameTrap reaches 70.0% with Claude Code and 60.0% with OpenCode and Aider. The gap reflects NameTrap's design: identifier choices are conditioned on the trust assumption underlying each target CWE and verified through probe completions before release.
5 Discussion
Why identifier poisoning works. In an incomplete file, the surrounding names are the main evidence an agent has about the intended behavior of the missing code. Names that denote trusted commands, prevalidated output, legacy-compatible digests, or trusted serialized state encode a trust assumption, and an agent that follows the conventions of the codebase, which is normally desirable behavior, consequently omits sanitization, escaping, or safe APIs. Because the bait is valid and functionally identical code, it contains nothing that instruction-oriented filters or present-code vulnerability scanners are designed to flag (RQ7).
Why some CWEs are easier to induce. The per-CWE results (RQ4) follow how much the poisoned names must justify. For CWE-502 and CWE-327, the vulnerable choice is a single, idiomatic standard-library call, such as pickle-based deserialization or an MD5 or SHA-1 digest, which becomes the most direct implementation once the surrounding names assert that the data is trusted or that legacy compatibility is required. For CWE-78, names that mark a command as trusted make shell-based execution appear consistent with the codebase. For CWE-79, the agent must actively omit escaping when constructing output, which overrides a strong default in Web code; this explains both the lower ASR and the lower bait yield for this category.
Implications for the Web ecosystem. Public code-hosting platforms and package registries already serve as distribution channels for malicious software [44]. NameTrap shows that, once agents consume this content, an attacker no longer needs to ship malicious code; shipping misleading names suffices. Because bait transfers across LLMs (RQ5) and remains effective under different prompt languages (RQ3), a single published file can affect agents built on models the attacker never queried. Identifier-only bait also suits the channels through which agents acquire code on the Web. Because the bait is functionally identical to the original, it can be submitted as a cosmetic naming-cleanup pull request, distributed as a fork or mirror of a popular project, or published as example code in a tutorial, gist, or Q&A answer that agents retrieve through Web search. Unlike a malicious dependency, such bait passes functional tests and leaves no behavioral trace until an agent extends it.
Mitigations. RQ6 and RQ7 show that defenses must shift from inspecting the ingested artifact to inspecting the generated code and its provenance. Agent frameworks should (i) treat identifiers in third-party code as untrusted input rather than as specifications, (ii) run security analysis on every agent-generated change before it is committed, since the targeted weaknesses become detectable once written, and (iii) record which external files influenced each generated edit so that reviewers can audit changes that depend on third-party code.
Ethical considerations. All bait files were constructed and evaluated in isolated local environments. No poisoned file was published to a public repository or package registry, and the study involved no human subjects. All source projects, coding agents, and language models used in this study are publicly available.
6 Conclusion
We presented NameTrap, an inference-time source-code poisoning attack that steers AI coding agents toward attacker-chosen vulnerabilities solely by renaming identifiers in third-party files. Across six coding agents, ten LLMs, and four CWE categories, identifier-only bait induces targeted vulnerabilities from screened clean baselines, outperforms random renaming, neutral renaming, and XOXO, transfers across models, survives a prompt-level security reminder, and evades seven AI-based and static analyzers. As coding agents increasingly build software from code retrieved from the Web, the semantics of untrusted identifiers must be treated as part of their attack surface. Future work includes extending NameTrap to other programming languages and CWE classes, and developing identifier-aware defenses that reason explicitly about the trust assumptions encoded in names.
References
[1] Hojjat Aghakhani, Wei Dai, Andre Manoel, Xavier Fernandes, Anant Kharkar, Christopher Kruegel, Giovanni Vigna, David Evans, Ben Zorn, and Robert Sim. 2024. TrojanPuzzle: Covertly Poisoning Code-Suggestion Models. In 2024 IEEE Symposium on Security and Privacy (SP). IEEE Computer Society, 1122–1140. doi:10.1109/SP54263.2024.00140
[2] Manish Bhatt, Sahana Chennabasappa, Yue Li, Cyrus Nikolaidis, Daniel Song, Shengye Wan, Faizan Ahmad, Cornelius Aschermann, Yaohui Chen, Dhaval Kapil, David Molnar, Spencer Whitman, and Joshua Saxe. 2024. CyberSecEval 2: A Wide-Ranging Cybersecurity Evaluation Suite for Large Language Models. arXiv:2404.13161
[3] Sizhe Chen, Julien Piet, Chawin Sitawarin, and David Wagner. 2025. StruQ: Defending Against Prompt Injection with Structured Queries. In Proceedings of the 34th USENIX Conference on Security Symposium. USENIX Association, Article 123, 18 pages.
[4] Zhaorun Chen, Zhen Xiang, Chaowei Xiao, Dawn Song, and Bo Li. 2024. Agent-Poison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases. In The Thirty-eighth Annual Conference on Neural Information Processing Systems.
[5] Edoardo Debenedetti, Jie Zhang, Mislav Balunovic, Luca Beurer-Kellner, Marc Fischer, and Florian Tramèr. 2024. AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents. In Proceedings of the 38th International Conference on Neural Information Processing Systems. Curran Associates Inc., Red Hook, NY, USA.
[6] Kai Greshake, Sahar Abdelnabi, Shailesh Mishra, Christoph Endres, Thorsten Holz, and Mario Fritz. 2023. Not What You've Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection. In Proceedings of the 16th ACM Workshop on Artificial Intelligence and Security. Association for Computing Machinery, 79–90. doi:10.1145/3605764.3623985
[7] Daya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng, Duyu Tang, Shujie LIU, Long Zhou, Nan Duan, Alexey Svyatkovskiy, Shengyu Fu, Michele Tufano, Shao Kun Deng, Colin Clement, Dawn Drain, Neel Sundaresan, Jian Yin, Daxin Jiang, and Ming Zhou. 2021. GraphCodeBERT: Pre-training Code Representations with Data Flow. In International Conference on Learning Representations.
[8] Jingxuan He and Martin Vechev. 2023. Large Language Models for Code: Security Hardening and Adversarial Testing. In Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security (CCS '23). Association for Computing Machinery, 1865–1879. doi:10.1145/3576915.3623175
[9] Akshita Jha and Chandan K. Reddy. 2023. CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Models. In Proceedings of the Thirty-Seventh AAAI Conference on Artificial Intelligence and Thirty-Fifth Conference on Innovative Applications of Artificial Intelligence and Thirteenth Symposium on Educational Advances in Artificial Intelligence. AAAI Press. doi:10.1609/aaai.v37i12.26739
[10] Carlos E Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and Karthik R Narasimhan. 2024. SWE-bench: Can Language Models Resolve Real-world Github Issues?. In The Twelfth International Conference on Learning Representations.
[11] Daoyuan Li. 2026. RepoGuardBench: Repository-Borne Prompt Injection Attacks and Lightweight Defenses for Local Coding Agents. In Deep Learning for Code: Towards Human-Centered Coding Agents.
[12] Zeyi Liao, Lingbo Mo, Chejian Xu, Mintong Kang, Jiawei Zhang, Chaowei Xiao, Yuan Tian, Bo Li, and Huan Sun. 2025. EIA: Environmental Injection Attack on Generalist Web Agents for Privacy Leakage. In International Conference on Learning Representations.
[13] Tianyang Liu, Canwen Xu, and Julian McAuley. 2024. RepoBench: Benchmarking Repository-Level Code Auto-Completion Systems. In International Conference on Learning Representations, Vol. 2024. 47832–47850.
[14] Yupei Liu, Yuqi Jia, Runpeng Geng, Jinyuan Jia, and Neil Zhenqiang Gong. 2024. Formalizing and Benchmarking Prompt Injection Attacks and Defenses. In 33rd USENIX Security Symposium (USENIX Security 24). USENIX Association, 1831–1847.
[15] Yue Liu, Yanjie Zhao, Yunbo Lyu, Ting Zhang, Haoyu Wang, and David Lo. 2026. "Your AI, My Shell": Demystifying Prompt Injection Attacks on Agentic AI Coding Editors. arXiv:2509.22040 [cs.CR]
[16] Hammond Pearce, Baleegh Ahmad, Benjamin Tan, Brendan Dolan-Gavitt, and Ramesh Karri. 2025. Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions. Commun. ACM (2025), 96–105. doi:10.1145/3610721
[17] Jinjun Peng, Leyi Cui, Kele Huang, Junfeng Yang, and Baishakhi Ray. 2025. CW-Eval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generation. In 2025 IEEE/ACM International Workshop on Large Language Models for Code (LLM4Code). 33–40. doi:10.1109/LLM4Code66737.2025.00009
[18] Neil Perry, Megha Srivastava, Deepak Kumar, and Dan Boneh. 2023. Do Users Write More Insecure Code with AI Assistants?. In Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security. Association for Computing Machinery, 2785–2799. doi:10.1145/3576915.3623157
[19] Yangjun Ruan, Honghua Dong, Andrew Wang, Silviu Pitis, Yongchao Zhou, Jimmy Ba, Yann Dubois, Chris Maddison, and Tatsunori Hashimoto. 2024. Identifying the Risks of LM Agents with an LM-Emulated Sandbox. In International Conference on Learning Representations, Vol. 2024. 27031–27098.
[20] Roei Schuster, Congzheng Song, Eran Tromer, and Vitaly Shmatikov. 2021. You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completion. In 30th USENIX Security Symposium (USENIX Security 21). USENIX Association, 1559–1575.
[21] Chihao Shen, Connor Dilgren, Purva Chiniya, Luke Griffith, Yu Ding, and Yizheng Chen. 2026. SecRepoBench: Benchmarking Code Agents for Secure Code Completion in Real-World Repositories. In Proceedings of the 3rd International Workshop on Large Language Models For Code. Association for Computing Machinery, 159–166. doi:10.1145/3786181.3788703
[22] Joseph Spracklen, Raveen Wijewickrama, A H M Nazmus Sakib, Anindya Maiti, Bimal Viswanath, and Murtuza Jadliwala. 2025. We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs. In 34th USENIX Security Symposium (USENIX Security 25). USENIX Association, 3687–3706.
[23] Adam Storek, Mukur Gupta, Noopur Bhatt, Aditya Gupta, Janie Kim, Prashast Srivastava, and Suman Jana. 2026. XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistants. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Association for Computational Linguistics, 11350–11373. doi:10.18653/v1/2026.acl-long.521
[24] Khang Tran, Yazan Boshmaf, Issa Khalil, Hai Phan, Ting Yu, and Md Rizwan Parvez. 2026. Poison with Style: A Practical Poisoning Attack on Code Large Language Models. In Forty-third International Conference on Machine Learning.
[25] Mark Vero, Niels Mündler, Victor Chibotaru, Veselin Raychev, Maximilian Baader, Nikola Jovanović, Jingxuan He, and Martin Vechev. 2025. BaxBench: Can LLMs Generate Correct and Secure Backends?. In Forty-second International Conference on Machine Learning.
[26] Eric Wallace, Kai Xiao, Reimar Leike, Lilian Weng, Johannes Heidecke, and Alex Beutel. 2024. The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions. arXiv:2404.13208
[27] Shiqi Wang, Zheng Li, Haifeng Qian, Chenghao Yang, Zijian Wang, Mingyue Shang, Varun Kumar, Samson Tan, Baishakhi Ray, Parminder Bhatia, Ramesh Nallapati, Murali Krishna Ramanathan, Dan Roth, and Bing Xiang. 2023. ReCode: Robustness Evaluation of Code Generation Models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Association for Computational Linguistics, 13818–13843. doi:10.18653/v1/2023.acl-long.773
[28] Xingyao Wang, Boxuan Li, Yufan Song, Frank F. Xu, Xiangru Tang, Mingchen Zhuge, Jiayi Pan, Yueqi Song, Bowen Li, Jaskirat Singh, Hoang H. Tran, Fuqiang Li, Ren Ma, Mingzhang Zheng, Bill Qian, Daniel Shao, Niklas Muennighoff, Yizhe Zhang, Binyuan Hui, Junyang Lin, Robert Brennan, Hao Peng, Heng Ji, and Graham Neubig. 2025. OpenHands: An Open Platform for AI Software Developers as Generalist Agents. In The Thirteenth International Conference on Learning Representations.
[29] Yue Wang, Weishi Wang, Shafiq Joty, and Steven C.H. Hoi. 2021. CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, 8696–8708. doi:10.18653/v1/2021.emnlp-main.685
[30] Yanlin Wang, Ziyao Zhang, Chong Wang, Xinyi Xu, Mingwei Liu, Yong Wang, Jiachi Chen, and Zibin Zheng. 2026. RealSec-bench: A Benchmark for Evaluating Secure Code Generation in Real-World Repositories. In Findings of the Association for Computational Linguistics: ACL 2026. Association for Computational Linguistics. doi:10.18653/v1/2026.findings-acl.1786
Chieh-Yuan Chang, Guan-Wei Chen, Chia-Yi Hsu, Chih Yang, Chia-Mu Yu, Chun-Ying Huang
Table 9: Attack success rates (ASR, %) across ten LLMs and three coding agents using Traditional Chinese prompts. Bold: highest overall gross ASR per agent.
| Agent | Model | CWE-78 | CWE-79 | CWE-327 | CWE-502 | All | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| G | P | G | P | G | P | G | P | G | P | ||
| OpenCode | Qwen-3.5-27B-AWQ-4bit | 46.0 | 46.0 | 20.0 | 20.0 | 70.0 | 70.0 | 28.0 | 28.0 | 36.9 | 36.9 |
| Qwen-3.5-4B | 50.0 | 50.0 | 0.0 | 0.0 | — | — | — | — | 25.0 | 25.0 | |
| Qwen-3.5-9B | 20.0 | 20.0 | 10.0 | 10.0 | 70.0 | 70.0 | 85.0 | 85.0 | 54.0 | 54.0 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 36.7 | 36.7 | 38.0 | 38.0 | — | — | 53.3 | 53.3 | 41.8 | 41.8 | |
| Gemma-4-26B-A4B | 0.0 | 0.0 | — | — | 80.0 | 88.9 | 60.0 | 60.0 | 50.0 | 51.3 | |
| Gemma-4-31B | 60.0 | 60.0 | — | — | 100.0 | 100.0 | 65.0 | 65.0 | 72.5 | 72.5 | |
| Nemotron-3-Nano-30B-A3B | 6.7 | 7.1 | 0.0 | 0.0 | 13.3 | 14.8 | 10.0 | 10.0 | 8.2 | 8.6 | |
| GPT-5.4-mini | 0.0 | 0.0 | — | — | 10.0 | 10.0 | 20.0 | 20.0 | 10.0 | 10.0 | |
| DeepSeek-V4-Flash-0731 | 5.0 | 5.0 | — | — | 30.0 | 30.0 | 30.0 | 30.0 | 10.0 | 10.0 | |
| Claude Haiku 4.5 | — | — | — | — | 50.0 | 50.0 | — | — | 50.0 | 50.0 | |
| Claude Code | Qwen-3.5-27B-AWQ-4bit | 20.0 | 20.0 | 0.0 | 0.0 | 70.0 | 70.0 | 50.0 | 50.0 | 29.0 | 29.0 |
| Qwen-3.5-4B | 7.5 | 8.6 | 13.3 | 16.0 | 60.0 | 60.0 | 36.7 | 41.5 | 25.0 | 28.5 | |
| Qwen-3.5-9B | 27.1 | 27.9 | 18.0 | 18.4 | 90.0 | 90.0 | 25.0 | 31.2 | 27.6 | 29.6 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 45.0 | 45.0 | 55.0 | 55.0 | — | — | — | — | 50.0 | 50.0 | |
| Gemma-4-26B-A4B | 10.0 | 10.0 | 6.7 | 9.5 | 27.5 | 30.6 | 5.0 | 5.0 | 13.8 | 15.4 | |
| Gemma-4-31B | 30.0 | 30.0 | 56.5 | 57.8 | 26.7 | 26.7 | 10.0 | 10.0 | 36.2 | 36.5 | |
| Nemotron-3-Nano-30B-A3B | 15.0 | 18.8 | 0.0 | 0.0 | 13.3 | 16.0 | 65.0 | 86.7 | 23.0 | 30.3 | |
| GPT-5.4-mini | 5.0 | 5.3 | 26.7 | 28.6 | 15.0 | 15.0 | 30.0 | 34.6 | 21.0 | 22.6 | |
| DeepSeek-V4-Flash-0731 | 25.0 | 26.3 | 20.0 | 20.0 | 20.0 | 22.2 | 10.0 | 10.0 | 21.1 | 22.4 | |
| Claude Haiku 4.5 | 40.0 | 40.0 | 16.7 | 16.7 | 0.0 | 0.0 | 100.0 | 100.0 | 36.7 | 40.2 | |
| Codex | Qwen-3.5-27B-AWQ-4bit | 14.3 | 14.3 | 25.0 | 29.4 | 5.0 | 5.3 | 40.0 | 40.0 | 22.5 | 23.1 |
| Qwen-3.5-4B | 12.9 | 13.6 | 13.3 | 14.8 | 7.5 | 10.7 | 36.0 | 40.9 | 17.9 | 20.6 | |
| Qwen-3.5-9B | 21.1 | 21.6 | 7.9 | 8.3 | 3.3 | 3.6 | 20.0 | 21.4 | 14.6 | 15.2 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 46.7 | 48.3 | 0.0 | 0.0 | 5.0 | 5.0 | 5.0 | 5.0 | 17.8 | 18.0 | |
| Gemma-4-26B-A4B | 0.0 | 0.0 | 2.5 | 5.9 | 63.3 | 70.4 | — | — | 25.0 | 42.6 | |
| Gemma-4-31B | 25.0 | 28.6 | 15.0 | 20.0 | 20.0 | 28.6 | 5.0 | 5.9 | 18.2 | 22.7 | |
| Nemotron-3-Nano-30B-A3B | 0.0 | — | 5.0 | 50.0 | 5.0 | 33.3 | 15.0 | 75.0 | 8.0 | 61.5 | |
| GPT-5.4-mini | 25.0 | 29.4 | 10.0 | 11.1 | 20.0 | 22.7 | 5.0 | 6.2 | 17.0 | 19.8 | |
| DeepSeek-V4-Flash-0731 | 28.3 | 28.3 | — | — | 20.0 | 22.2 | 80.0 | 80.0 | 33.8 | 34.2 | |
| Claude Haiku 4.5 | 5.0 | 5.0 | — | — | 15.0 | 20.0 | 20.0 | 20.0 | 15.0 | 16.0 | |
Table 10: Detection results for bait code generated with Claude Code across AI-based and traditional static analysis tools.
| Model | CWE-78 | CWE-79 | CWE-327 | CWE-502 | All |
|---|---|---|---|---|---|
| Qwen-3.5-27B-AWQ-4bit | |||||
| Qwen-3.5-4B | |||||
| Qwen-3.5-9B | |||||
| Qwen-3.5-122B-A10B-AWQ-4bit | — | — | |||
| Gemma-4-26B-A4B | |||||
| Gemma-4-31B | |||||
| Nemotron-3-Nano-30B-A3B | |||||
| GPT-5.4-mini | |||||
| DeepSeek-V4-Flash-0731 | |||||
| Claude Haiku 4.5 | |||||
| Overall |
Each cell reports bait/control detection rates and holds for all seven tools (CodeGemma, CodeAstra-7B, GPT-5.4-mini, Bandit, Semgrep, CodeShield, and CodeQL), except CodeShield on CWE-79, which has no applicable rule in any row. —: no qualifying bait code. Exceptions (CodeGemma, bait/control): , ; ; .
[31] Jin Wen, Qiang Hu, Yuejun Guo, Maxime Cordy, and Yves Le Traon. 2025. Variable Renaming-Based Adversarial Test Generation for Code Model: Benchmark and Enhancement. ACM Trans. Softw. Eng. Methodol. 35, 1, Article 6 (2025). doi:10.1145/3723353
[32] Chunqiu Steven Xia, Yinlin Deng, Soren Dunn, and Lingming Zhang. 2025. Demystifying LLM-Based Software Engineering Agents. Proc. ACM Softw. Eng. 2, FSE (2025), 24 pages. doi:10.1145/3715754
[33] Shenao Yan, Shen Wang, Yue Duan, Hanbin Hong, Kiho Lee, Doowon Kim, and Yuan Hong. 2024. An LLM-Assisted Easy-to-Trigger Backdoor Attack on Code Completion Models: Injecting Disguised Vulnerabilities against Strong Detection. In 33rd USENIX Security Symposium (USENIX Security 24). USENIX Association, 1795–1812.
[34] John Yang, Carlos E. Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, and Ofir Press. 2024. SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering. In Proceedings of the 38th International Conference on Neural Information Processing Systems. Curran Associates Inc., 125 pages.
[35] Zhou Yang, Jieke Shi, Junda He, and David Lo. 2022. Natural Attack for Pre-trained Models of Code. In 2022 IEEE/ACM 44th International Conference on Software Engineering (ICSE). 1482–1493. doi:10.1145/3510003.3510146
Table 11: Detection results for bait code generated with Codex CLI across AI-based and traditional static analysis tools.
| Model | CWE-78 | CWE-79 | CWE-327 | CWE-502 | All |
|---|---|---|---|---|---|
| Qwen-3.5-27B-AWQ-4bit | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
| Qwen-3.5-4B | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
| Qwen-3.5-9B | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
| Qwen-3.5-122B-A10B-AWQ-4bit | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
| Gemma-4-26B-A4B | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | — | 0.0 / 0.0 |
| Gemma-4-31B | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
| Nemotron-3-Nano-30B-A3B | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
| GPT-5.4-mini | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
| DeepSeek-V4-Flash-0731 | 0.0 / 0.0 | — | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
| Claude Haiku 4.5 | 0.0 / 0.0 | — | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
| Overall | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 |
Each cell reports bait/control detection rates and holds for all seven tools (CodeGemma, CodeAstra-7B, GPT-5.4-mini, Bandit, Semgrep, CodeShield, and CodeQL), except CodeShield on CWE-79, which has no applicable rule in any row. —: no qualifying bait code.
[36] Zhou Yang, Bowen Xu, Jie M. Zhang, Hong Jin Kang, Jieke Shi, Junda He, and David Lo. 2024. Stealthy Backdoor Attack for Code Models. IEEE Trans. Softw. Eng. 50, 4 (2024), 721–741. doi:10.1109/TSE.2024.3361661
[37] Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik N Narasimhan, and Yuan Cao. 2023. ReAct: Synergizing Reasoning and Acting in Language Models. In The Eleventh International Conference on Learning Representations.
[38] Noam Yefet, Uri Alon, and Eran Yahav. 2020. Adversarial Examples for Models of Code. Proc. ACM Program. Lang. 4, OOPSLA, Article 162 (2020), 30 pages. doi:10.1145/3428230
[39] Alperen Yildiz, Sin G Teo, Yiling Lou, Yebo Feng, Chong Wang, and Dinil Mon Di-vakaran. 2025. Benchmarking LLMs and LLM-based Agents in Practical Vulnerability Detection for Code Repositories. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Association for Computational Linguistics, 30848–30865. doi:10.18653/v1/2025.acl-long.1490
[40] Qiusi Zhan, Zhixiang Liang, Zifan Ying, and Daniel Kang. 2024. InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents. In Findings of the Association for Computational Linguistics: ACL 2024. Association for Computational Linguistics, 10471–10506. doi:10.18653/v1/2024.findings-acl.624
[41] Fengji Zhang, Bei Chen, Yue Zhang, Jacky Keung, Jin Liu, Daoguang Zan, Yi Mao, Jian-Guang Lou, and Weizhu Chen. 2023. RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, 2471–2484. doi:10.18653/v1/2023.emnlp-main.151
[42] Hanrong Zhang, Jingyuan Huang, Kai Mei, Yifei Yao, Zhenting Wang, Chenlu Zhan, Hongwei Wang, and Yongfeng Zhang. 2025. Agent Security Bench (ASB): Formalizing and Benchmarking Attacks and Defenses in LLM-based Agents. In The Thirteenth International Conference on Learning Representations.
[43] Fukang Zhu, Binbin Zhao, Ruixiao Lin, Ping He, Tianyu Du, and Shouling Ji. 2026. Beyond the Payload: How User Invocation Shapes Coding Agent Vulnerability to Repository Poisoning. arXiv:2608.30686 [cs.CR]
[44] Markus Zimmermann, Cristian-Alexandru Staicu, Cam Tenny, and Michael Pradel. 2019. Small World with High Risks: A Study of Security Threats in the npm Ecosystem. In 28th USENIX Security Symposium (USENIX Security 19). USENIX Association, 995–1010.
[45] Wei Zou, Runpeng Geng, Binghui Wang, and Jinyuan Jia. 2025. PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models. In 34th USENIX Security Symposium (USENIX Security 25). USENIX Association, 3827–3844.
A Additional Results Across Agent-Model Configurations
We repeat the experiment of Table 3 with Traditional Chinese instead of English coding prompts, covering ten LLMs, three agents (OpenCode, Claude Code, and Codex), and four CWE categories. As shown in Table 9, Traditional Chinese prompts yield higher overall gross ASRs in 23 of the 30 agent-model configurations and raise the mean overall gross ASR from 22.3% to 27.7%. The increase is largest for CWE-327 and CWE-502, whose mean gross ASRs rise from 26.8% to 33.7% and from 28.2% to 35.0%, respectively.
B Additional Security Detection Results
We extend the detection experiments of Section 4.8 to bait constructed with Claude Code and Codex, using the same seven tools and bait/control comparison. Tables 10 and 11 report the results, covering 108 and 121 bait/control pairs, respectively. In both cases, no tool detects the targeted CWEs in any poisoned file, consistent with the OpenCode results.
C Cross-Model Transferability for Other CWEs
Following the setting of Table 5, we extend the cross-model transferability evaluation to CWE-79, CWE-327, and CWE-502 with the same three coding agents and ten LLMs (Tables 12, 14 and 15). Across all three categories, identifier-poisoned code transfers substantially, and many cross-model combinations exceed the corresponding same-model ASR. Aggregated over all cross-model pairs with qualifying bait, the bait induces the target CWE in at least one completion for 71.5% of the pairs for CWE-79, 72.4% for CWE-327, and 86.3% for CWE-502, compared with 65.5% for CWE-78, and it is more effective than on its source model in 58.9%, 49.8%, and 47.9% of the pairs, respectively. For CWE-79, bait generated by Qwen-3.5-4B with OpenCode achieves a gross ASR of 10.0% against its source model but 100.0% against DeepSeek-V4-Flash-0731. For CWE-327, bait generated by Gemma-4-31B with Codex achieves 10.0% against itself but 83.3% against Qwen-3.5-122B-A10B-AWQ-4bit. For CWE-502, bait generated by Nemotron-3-Nano-30B-A3B with Codex achieves 17.5% against its source model but 97.5% against DeepSeek-V4-Flash-0731. Transfer is not uniform: some model combinations yield no successful attack, while others approach or reach 100.0%. These results extend the CWE-78 findings: identifier-based poisoning transfers across LLMs and vulnerability categories without requiring the bait-generation and victim models to coincide, while its strength depends on the targeted CWE, the agent framework, and the specific model pair.
D Prompt-Based Defense Across Coding Agents
We apply the security reminder of Section 4.7 to all six agents with Qwen-3.5-27B-AWQ-4bit (??). Relative to the undefended results in Table 2, the reminder lowers the overall gross ASR of Aider from 56.0% to 35.0% (CWE-79: 63.3% to 6.7%) and of OpenHands from 22.5% to 17.5% (CWE-327: 25.0% to 5.0%), and mini-swe's ASR on CWE-327 from 40.0% to 10.0%. In contrast, Claude Code's overall gross ASR rises from 25.0% to 29.0%, and the ASR on CWE-502 rises from 27.5% to 37.5% for Aider and from 20.0% to 50.0% for OpenHands. Aider still reaches 70.0% on CWE-78, Claude Code 70.0% on CWE-327, and mini-swe and OpenHands 50.0% on CWE-502, so the reminder does not consistently mitigate the attack.
Chieh-Yuan Chang†, Guan-Wei Chen†, Chia-Yi Hsu†, Chih Yang†, Chia-Mu Yu†, Chun-Ying Huang†
Table 12: Cross-model transferability of bait code on CWE-79 (cross-site scripting). Same format as Table 5.
| Agent | Bait model | Task-completion model | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Qwen-3.5-27B-AWQ-4bit | Qwen-3.5-4B | Qwen-3.5-9B | Qwen-3.5-122B-A10B-AWQ-4bit | Gemma-4-26B-A4B | Gemma-4-31B | Nemotron-3-Nano-30B-A3B | GPT-5.4-mini | DeepSeek-V4-Flash-0731 | Claude Haiku 4.5 | ||
| OpenCode | Qwen-3.5-27B-AWQ-4bit | 30.0 / 30.0 | 0.0 / 0.0 | 0.0 / 0.0 | 10.0 / 10.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 35.0 / 35.0 | 95.0 / 95.0 | 65.0 / 65.0 |
| Qwen-3.5-4B | 0.0 / 0.0 | 10.0 / 10.0 | 0.0 / 0.0 | 30.0 / 30.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 20.0 / 20.0 | 100.0 / 100.0 | 40.0 / 40.0 | |
| Qwen-3.5-9B | 100.0 / 100.0 | 0.0 / 0.0 | 10.0 / 10.0 | 70.0 / 70.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 40.0 / 40.0 | 90.0 / 90.0 | 100.0 / 100.0 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 98.0 / 98.0 | 0.0 / 0.0 | 6.0 / 6.0 | 28.0 / 28.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 42.0 / 42.0 | 96.0 / 96.0 | 94.0 / 94.0 | |
| Gemma-4-26B-A4B | – | – | – | – | – | – | – | – | – | – | |
| Gemma-4-31B | – | – | – | – | – | – | – | – | – | – | |
| Nemotron-3-Nano-30B-A3B | 100.0 / 100.0 | 0.0 / 0.0 | 30.0 / 30.0 | 50.0 / 50.0 | 50.0 / 50.0 | 50.0 / 50.0 | 0.0 / 0.0 | 60.0 / 60.0 | 90.0 / 90.0 | 100.0 / 100.0 | |
| GPT-5.4-mini | – | – | – | – | – | – | – | – | – | – | |
| DeepSeek-V4-Flash-0731 | – | – | – | – | – | – | – | – | – | – | |
| Claude Haiku 4.5 | – | – | – | – | – | – | – | – | – | – | |
| Claude Code | Qwen-3.5-27B-AWQ-4bit | 0.0 / 0.0 | 10.0 / 10.0 | 0.0 / 0.0 | 30.0 / 30.0 | 0.0 / 0.0 | 0.0 / – | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 70.0 / 70.0 |
| Qwen-3.5-4B | 20.0 / 20.0 | 6.7 / 7.1 | 13.3 / 13.8 | 23.3 / 23.3 | 0.0 / 0.0 | 10.0 / 12.5 | 0.0 / 0.0 | 63.3 / 67.9 | 73.3 / 75.9 | 46.7 / 46.7 | |
| Qwen-3.5-9B | 78.0 / 78.0 | 6.0 / 6.1 | 6.0 / 6.2 | 64.0 / 64.0 | 6.0 / 6.5 | 6.0 / 6.0 | 10.0 / 11.6 | 84.0 / 84.0 | 68.0 / 68.0 | 98.0 / 98.0 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 70.0 / 70.0 | 10.0 / 16.7 | 10.0 / 10.0 | 20.0 / 20.0 | 10.0 / 10.0 | 5.0 / 5.9 | 0.0 / 0.0 | 90.0 / 90.0 | 70.0 / 70.0 | 70.0 / 70.0 | |
| Gemma-4-26B-A4B | 40.0 / 40.0 | 3.3 / 3.7 | 6.7 / 7.4 | 56.7 / 56.7 | 3.3 / 4.8 | 13.3 / 15.4 | 0.0 / 0.0 | 53.3 / 57.1 | 80.0 / 85.7 | 70.0 / 70.0 | |
| Gemma-4-31B | 72.3 / 72.3 | 4.8 / 5.0 | 32.5 / 33.3 | 45.0 / 45.0 | 0.0 / 0.0 | 27.5 / 28.9 | 9.3 / 11.4 | 60.9 / 60.9 | 89.4 / 89.4 | 90.0 / 90.0 | |
| Nemotron-3-Nano-30B-A3B | 100.0 / 100.0 | 0.0 / 0.0 | 10.0 / 11.1 | 100.0 / 100.0 | 0.0 / 0.0 | 80.0 / 100.0 | 0.0 / 0.0 | 100.0 / 100.0 | 90.0 / 100.0 | 100.0 / 100.0 | |
| GPT-5.4-mini | 36.7 / 36.7 | 3.3 / 4.5 | 3.3 / 4.3 | 33.3 / 33.3 | 0.0 / 0.0 | 20.0 / 20.0 | 0.0 / 0.0 | 13.3 / 14.8 | 46.7 / 53.8 | 33.3 / 33.3 | |
| DeepSeek-V4-Flash-0731 | 0.0 / 0.0 | 10.0 / 10.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 40.0 / 40.0 | 10.0 / 11.1 | 100.0 / 100.0 | |
| Claude Haiku 4.5 | 3.3 / 3.3 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 26.7 / 27.6 | 56.7 / 58.6 | 16.7 / 16.7 | |
| Codex | Qwen-3.5-27B-AWQ-4bit | 30.0 / 37.5 | 0.0 / 0.0 | 0.0 / 0.0 | 15.0 / 17.6 | 0.0 / 0.0 | 15.0 / 27.3 | 0.0 / 0.0 | 45.0 / 60.0 | 80.0 / 80.0 | 50.0 / 52.6 |
| Qwen-3.5-4B | 40.0 / 41.4 | 13.3 / 14.3 | 13.3 / 14.8 | 30.0 / 30.0 | 6.7 / 22.2 | 16.7 / 20.0 | 13.3 / 66.7 | 56.7 / 70.8 | 66.7 / 66.7 | 63.3 / 63.3 | |
| Qwen-3.5-9B | 65.1 / 67.2 | 9.4 / 10.0 | 18.0 / 18.3 | 64.5 / 64.5 | 4.3 / 13.0 | 49.2 / 54.5 | 1.6 / 9.1 | 78.5 / 78.5 | 87.1 / 88.4 | 98.6 / 98.6 | |
| Qwen-3.5-122B-A10B-AWQ-4bit | 10.0 / 10.0 | 15.0 / 16.7 | 20.0 / 21.1 | 15.0 / 15.0 | 20.0 / 40.0 | 30.0 / 33.3 | 0.0 / 0.0 | 90.0 / 90.0 | 60.0 / 60.0 | 85.0 / 85.0 | |
| Gemma-4-26B-A4B | 92.5 / 92.5 | 20.0 / 22.9 | 20.0 / 20.5 | 87.5 / 87.5 | 0.0 / 0.0 | 72.5 / 78.4 | 2.5 / 10.0 | 72.5 / 72.5 | 100.0 / 100.0 | 100.0 / 100.0 | |
| Gemma-4-31B | 55.0 / 55.0 | 0.0 / 0.0 | 25.0 / 27.8 | 65.0 / 65.0 | 0.0 / 0.0 | 10.0 / 12.5 | 0.0 / 0.0 | 50.0 / 58.8 | 100.0 / 100.0 | 95.0 / 95.0 | |
| Nemotron-3-Nano-30B-A3B | 100.0 / 100.0 | 65.0 / 72.2 | 70.0 / 73.7 | 100.0 / 100.0 | 50.0 / 100.0 | 70.0 / 100.0 | 5.0 / 20.0 | 100.0 / 100.0 | 100.0 / 100.0 | 100.0 / 100.0 | |
| GPT-5.4-mini | 40.0 / 40.0 | 0.0 / 0.0 | 0.0 / 0.0 | 40.0 / 40.0 | 0.0 / – | 0.0 / 0.0 | 0.0 / 0.0 | 0.0 / 0.0 | 70.0 / 70.0 | 40.0 / 40.0 | |
| DeepSeek-V4-Flash-0731 | – | – | – | – | – | – | – | – | – | – | |
| Claude Haiku 4.5 | – | – | – | – | – | – | – | – | – | – | |
NameTrap: Steering AI Coding Agents Toward Security Vulnerabilities via Variable Names WWW ’27, May 10–14, 2027, Dublin, Ireland Table 14: Cross-model transferability of bait code on CWE-327 (broken or risky cryptographic algorithm). Same format as Table 5. Task-completion model Agent Bait model Qwen-3.5- Qwen-3.5- Qwen-3.5- Qwen-3.5-122B- Gemma-4- Gemma-4- Nemotron-3- GPT-5.4- DeepSeek-V4- Claude 27B-AWQ-4bit 4B 9B A10B-AWQ-4bit 26B-A4B 31B Nano-30B-A3B mini Flash-0731 Haiku 4.5 Qwen-3.5-27B-AWQ-4bit 60.0 / 60.0 50.0 / 71.4 40.0 / 44.4 20.0 / 20.0 20.0 / 20.0 0.0 / 0.0 50.0 / 50.0 20.0 / 20.0 80.0 / 80.0 40.0 / 40.0 Qwen-3.5-4B — — — — — — — — — — Qwen-3.5-9B 100.0 / 100.0 40.0 / 40.0 50.0 / 50.0 100.0 / 100.0 70.0 / 70.0 100.0 / 100.0 30.0 / 33.3 70.0 / 70.0 90.0 / 90.0 70.0 / 100.0 Qwen-3.5-122B-A10B-AWQ-4bit — — — — — — — — — — Gemma-4-26B-A4B 100.0 / 100.0 20.0 / 22.2 80.0 / 100.0 100.0 / 100.0 40.0 / 44.4 100.0 / 100.0 0.0 / 0.0 80.0 / 80.0 100.0 / 100.0 100.0 / 100.0 Gemma-4-31B 90.0 / 90.0 40.0 / 40.0 90.0 / 90.0 100.0 / 100.0 100.0 / 100.0 100.0 / 100.0 10.0 / 10.0 0.0 / 0.0 60.0 / 60.0 80.0 / 88.9 Nemotron-3-Nano-30B-A3B 46.7 / 46.7 36.7 / 36.7 36.7 / 36.7 46.7 / 46.7 33.3 / 34.5 33.3 / 33.3 20.0 / 20.7 46.7 / 46.7 80.0 / 80.0 73.3 / 73.3 GPT-5.4-mini 5.0 / 5.0 0.0 / 0.0 0.0 / 0.0 5.0 / 5.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 45.0 / 45.0 0.0 / 0.0 DeepSeek-V4-Flash-0731 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 30.0 / 30.0 0.0 / 0.0 OpenCode Claude Haiku 4.5 40.0 / 40.0 40.0 / 40.0 80.0 / 80.0 40.0 / 40.0 50.0 / 50.0 0.0 / 0.0 10.0 / 10.0 0.0 / 0.0 10.0 / 10.0 40.0 / 40.0 Qwen-3.5-27B-AWQ-4bit 70.0 / 70.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / — 0.0 / 0.0 20.0 / 20.0 40.0 / 40.0 100.0 / 100.0 Qwen-3.5-4B 100.0 / 100.0 10.0 / 10.0 50.0 / 50.0 30.0 / 30.0 0.0 / 0.0 0.0 / — 50.0 / 50.0 10.0 / 10.0 30.0 / 30.0 10.0 / 10.0 Qwen-3.5-9B 100.0 / 100.0 30.0 / 30.0 100.0 / 100.0 100.0 / 100.0 70.0 / 70.0 90.0 / 90.0 40.0 / 40.0 90.0 / 100.0 100.0 / 100.0 100.0 / 100.0 Qwen-3.5-122B-A10B-AWQ-4bit — — — — — — — — — — Gemma-4-26B-A4B 57.5 / 57.5 15.0 / 16.2 10.0 / 10.8 42.5 / 42.5 27.5 / 27.5 0.0 / 0.0 20.0 / 21.1 70.0 / 70.0 50.0 / 54.1 75.0 / 75.0 Gemma-4-31B 66.7 / 66.7 40.0 / 40.0 53.3 / 55.2 83.3 / 83.3 60.0 / 90.0 40.0 / 40.0 20.0 / 23.1 53.3 / 53.3 73.3 / 78.6 63.3 / 63.3 Nemotron-3-Nano-30B-A3B 63.3 / 63.3 23.3 / 26.9 23.3 / 23.3 80.0 / 80.0 16.7 / 17.2 23.3 / 26.9 10.0 / 10.3 43.3 / 43.3 70.0 / 72.4 96.7 / 96.7 GPT-5.4-mini 100.0 / 100.0 40.0 / 42.1 40.0 / 40.0 55.0 / 55.0 50.0 / 55.6 0.0 / 0.0 30.0 / 31.6 10.0 / 10.0 25.0 / 27.8 70.0 / 70.0 DeepSeek-V4-Flash-0731 6.7 / 6.7 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 3.3 / 3.6 10.0 / 10.0 16.7 / 16.7 Claude Code Claude Haiku 4.5 20.0 / 22.2 5.0 / 10.0 0.0 / 0.0 20.0 / 21.1 0.0 / 0.0 5.0 / 5.0 10.0 / 20.0 40.0 / 42.1 45.0 / 47.4 5.0 / 5.9 Qwen-3.5-27B-AWQ-4bit 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 5.0 / 5.0 0.0 / 0.0 Qwen-3.5-4B 42.5 / 42.5 12.5 / 18.5 30.0 / 38.7 50.0 / 51.3 25.0 / 83.3 52.5 / 67.7 0.0 / 0.0 52.5 / 55.3 55.0 / 57.9 72.5 / 72.5 Qwen-3.5-9B 53.3 / 53.3 16.7 / 20.0 6.7 / 7.4 36.7 / 42.3 16.7 / 62.5 23.3 / 36.8 10.0 / 30.0 33.3 / 58.8 76.7 / 76.7 53.3 / 53.3 Qwen-3.5-122B-A10B-AWQ-4bit 50.0 / 50.0 5.0 / 5.0 25.0 / 26.3 10.0 / 10.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 25.0 / 26.3 45.0 / 45.0 25.0 / 25.0 Gemma-4-26B-A4B 73.3 / 73.3 16.7 / 18.5 36.7 / 36.7 50.0 / 50.0 26.7 / 44.4 16.7 / 17.9 0.0 / 0.0 60.0 / 60.0 66.7 / 66.7 70.0 / 70.0 Gemma-4-31B 80.0 / 80.0 43.3 / 44.8 56.7 / 60.7 83.3 / 83.3 36.7 / 84.6 10.0 / 13.0 10.0 / 27.3 36.7 / 39.3 60.0 / 60.0 53.3 / 53.3 Nemotron-3-Nano-30B-A3B 45.0 / 45.0 35.0 / 46.7 45.0 / 50.0 40.0 / 40.0 10.0 / 100.0 50.0 / 55.6 10.0 / 50.0 45.0 / 47.4 65.0 / 65.0 60.0 / 60.0 GPT-5.4-mini 52.0 / 56.5 2.0 / 3.2 30.0 / 35.7 28.0 / 29.8 10.0 / 55.6 16.0 / 24.2 2.0 / 10.0 20.0 / 22.2 54.0 / 56.2 46.0 / 52.3 DeepSeek-V4-Flash-0731 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / — 0.0 / 0.0 0.0 / — 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 Codex Claude Haiku 4.5 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 5.0 / 7.7 0.0 / — 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 10.0 / 10.5 5.0 / 5.3 Table 15: Cross-model transferability of bait code on CWE-502 (deserialization of untrusted data). Same format as Table 5. Task-completion model Agent Bait model Qwen-3.5- Qwen-3.5- Qwen-3.5- Qwen-3.5-122B- Gemma-4- Gemma-4- Nemotron-3- GPT-5.4- DeepSeek-V4- Claude 27B-AWQ-4bit 4B 9B A10B-AWQ-4bit 26B-A4B 31B Nano-30B-A3B mini Flash-0731 Haiku 4.5 Qwen-3.5-27B-AWQ-4bit 24.0 / 24.0 20.0 / 20.0 24.0 / 24.0 60.0 / 60.0 64.0 / 64.0 16.0 / 16.0 8.0 / 8.2 34.0 / 34.0 76.0 / 76.0 54.0 / 54.0 Qwen-3.5-4B — — — — — — — — — — Qwen-3.5-9B 75.0 / 75.0 50.0 / 50.0 50.0 / 58.8 90.0 / 90.0 100.0 / 100.0 100.0 / 100.0 5.0 / 5.6 50.0 / 50.0 85.0 / 85.0 95.0 / 100.0 Qwen-3.5-122B-A10B-AWQ-4bit 43.3 / 43.3 23.3 / 24.1 23.3 / 23.3 36.7 / 36.7 43.3 / 48.1 40.0 / 40.0 6.7 / 6.9 23.3 / 23.3 86.7 / 86.7 66.7 / 66.7 Gemma-4-26B-A4B 100.0 / 100.0 50.0 / 50.0 80.0 / 80.0 80.0 / 80.0 75.0 / 75.0 50.0 / 50.0 30.0 / 31.6 75.0 / 75.0 75.0 / 75.0 90.0 / 90.0 Gemma-4-31B 45.0 / 45.0 5.0 / 5.0 0.0 / 0.0 0.0 / 0.0 5.0 / 5.0 55.0 / 55.0 5.0 / 5.0 10.0 / 10.0 50.0 / 50.0 20.0 / 20.0 Nemotron-3-Nano-30B-A3B 10.0 / 10.0 13.3 / 13.3 6.7 / 6.7 30.0 / 30.0 23.3 / 23.3 6.7 / 6.7 16.7 / 16.7 6.7 / 6.7 76.7 / 76.7 36.7 / 36.7 GPT-5.4-mini 15.0 / 15.0 10.0 / 10.0 10.0 / 10.0 10.0 / 10.0 5.0 / 5.3 0.0 / 0.0 5.0 / 5.0 10.0 / 10.0 45.0 / 45.0 15.0 / 18.8 DeepSeek-V4-Flash-0731 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 10.0 / 10.0 20.0 / 20.0 10.0 / 10.0 OpenCode Claude Haiku 4.5 — — — — — — — — — — Qwen-3.5-27B-AWQ-4bit 55.0 / 55.0 40.0 / 40.0 30.0 / 30.0 45.0 / 45.0 50.0 / 50.0 50.0 / 50.0 25.0 / 26.3 10.0 / 10.0 30.0 / 31.6 45.0 / 45.0 Qwen-3.5-4B 60.0 / 60.0 33.3 / 37.0 33.3 / 33.3 61.7 / 61.7 36.7 / 37.3 45.0 / 45.0 33.3 / 35.1 28.3 / 28.3 55.0 / 55.0 68.3 / 68.3 Qwen-3.5-9B 45.0 / 45.0 10.0 / 12.5 17.5 / 21.9 47.5 / 47.5 45.0 / 46.2 25.0 / 25.0 40.0 / 40.0 22.5 / 27.3 55.0 / 55.0 62.5 / 62.5 Qwen-3.5-122B-A10B-AWQ-4bit — — — — — — — — — — Gemma-4-26B-A4B 55.0 / 55.0 15.0 / 15.0 35.0 / 35.0 30.0 / 30.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 25.0 / 26.3 25.0 / 25.0 Gemma-4-31B 90.0 / 90.0 10.0 / 10.5 20.0 / 20.0 80.0 / 80.0 0.0 / 0.0 15.0 / 16.7 15.0 / 21.4 20.0 / 20.0 50.0 / 50.0 50.0 / 50.0 Nemotron-3-Nano-30B-A3B 55.0 / 55.0 55.0 / 55.0 55.0 / 55.0 80.0 / 80.0 5.0 / 10.0 80.0 / 84.2 55.0 / 78.6 40.0 / 40.0 75.0 / 75.0 100.0 / 100.0 GPT-5.4-mini 60.0 / 60.0 16.7 / 20.8 36.7 / 45.8 26.7 / 26.7 40.0 / 42.9 6.7 / 6.7 16.7 / 17.9 16.7 / 19.2 70.0 / 80.8 70.0 / 70.0 DeepSeek-V4-Flash-0731 10.0 / 10.0 0.0 / 0.0 0.0 / 0.0 10.0 / 10.0 0.0 / 0.0 60.0 / 60.0 0.0 / 0.0 10.0 / 10.0 10.0 / 11.1 20.0 / 20.0 Claude Code Claude Haiku 4.5 100.0 / 100.0 90.0 / 90.0 70.0 / 70.0 100.0 / 100.0 80.0 / 80.0 95.0 / 100.0 100.0 / 100.0 90.0 / 90.0 100.0 / 100.0 100.0 / 100.0 Qwen-3.5-27B-AWQ-4bit 42.0 / 42.0 18.0 / 18.8 16.0 / 16.0 46.0 / 46.0 24.0 / 30.8 18.0 / 19.6 6.0 / 20.0 30.0 / 30.0 54.0 / 54.0 32.0 / 32.0 Qwen-3.5-4B 70.0 / 70.0 22.0 / 23.9 58.0 / 58.0 80.0 / 80.0 36.0 / 60.0 60.0 / 78.9 8.0 / 30.8 58.0 / 60.4 74.0 / 75.5 70.0 / 70.0 Qwen-3.5-9B 53.3 / 53.3 13.3 / 13.8 3.3 / 3.3 13.3 / 13.3 50.0 / 60.0 60.0 / 66.7 16.7 / 83.3 10.0 / 10.0 70.0 / 70.0 73.3 / 73.3 Qwen-3.5-122B-A10B-AWQ-4bit 20.0 / 20.0 10.0 / 10.5 10.0 / 10.0 10.0 / 10.0 5.0 / 11.1 0.0 / 0.0 0.0 / 0.0 25.0 / 25.0 65.0 / 65.0 35.0 / 35.0 Gemma-4-26B-A4B — — — — — — — — — — Gemma-4-31B 55.0 / 55.0 50.0 / 55.6 50.0 / 50.0 30.0 / 30.0 5.0 / 7.7 5.0 / 7.7 5.0 / 12.5 15.0 / 16.7 45.0 / 45.0 45.0 / 45.0 Nemotron-3-Nano-30B-A3B 80.0 / 80.0 50.0 / 51.3 57.5 / 57.5 95.0 / 95.0 45.0 / 72.0 72.5 / 90.6 17.5 / 77.8 60.0 / 60.0 97.5 / 97.5 87.5 / 87.5 GPT-5.4-mini 5.0 / 5.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 0.0 / 0.0 20.0 / 20.0 DeepSeek-V4-Flash-0731 50.0 / 50.0 0.0 / 0.0 10.0 / 10.0 40.0 / 40.0 0.0 / 0.0 30.0 / 33.3 20.0 / 28.6 0.0 / 0.0 30.0 / 30.0 90.0 / 90.0 Codex Claude Haiku 4.5 30.0 / 30.0 7.5 / 8.8 2.5 / 2.9 22.5 / 22.5 0.0 / 0.0 7.5 / 7.9 0.0 / 0.0 2.5 / 2.8 42.5 / 42.5 12.5 / 12.5
Chieh-Yuan Chang , Guan-Wei Chen , Chia-Yi Hsu , Chih Yang , Chia-Mu Yu , Chun-Ying Huang