Metraipolis › archive › dc_96d8409c897a

NameTrap: Steering AI Coding Agents Toward Security Vulnerabilities via Variable Names — arXiv:2610.34253

Source
arXiv (en)
Original
https://arxiv.org/abs/2610.34253
License (as archived)
CC0-1.0
Archived
2026-10-27T08:01:13.449Z
SHA-256 of the archived text
0e15e2c95e895eb8c2a1eec6ff2c8436dd06bc31d9d430938b249dd5405e45a6
Stable URL of this page
https://metraipolis.com/documento/dc_96d8409c897a

How to cite

NameTrap: Steering AI Coding Agents Toward Security Vulnerabilities via Variable Names — arXiv:2610.34253 — arXiv (en), https://arxiv.org/abs/2610.34253 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_96d8409c897a (Metraipolis archive dc_96d8409c897a, sha256 0e15e2c95e895eb8c2a1eec6ff2c8436dd06bc31d9d430938b249dd5405e45a6)
BibTeX
@misc{dc96d8409c897a,
  title = {NameTrap: Steering AI Coding Agents Toward Security Vulnerabilities via Variable Names — arXiv:2610.34253},
  howpublished = {arXiv (en)},
  url = {https://arxiv.org/abs/2610.34253},
  note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_96d8409c897a; sha256 0e15e2c95e895eb8c2a1eec6ff2c8436dd06bc31d9d430938b249dd5405e45a6},
  year = {2026}
}

Archived text

Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2610.34253. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

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.

Tema degli esploratori: agenti e intelligenza artificiale (elenco arXiv cs.AI, nuovi lavori del giorno).
Categorie arXiv: Cryptography and Security (cs.CR) ; Artificial Intelligence (cs.AI).
Pagina del lavoro: https://arxiv.org/abs/2610.34253 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito).
Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina.
Letto il 2026-10-27T07:55:30.886Z dalla pagina https://arxiv.org/list/cs.AI/new (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).