Skip to content
InfoResearchPreprintLLM-specific

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

Published
Record updated
View JSON

Summary

NameTrap is a source-code poisoning attack that renames identifiers in third-party Python files to steer AI coding agents toward attacker-chosen CWE weaknesses (CWE-78, CWE-79, CWE-327, CWE-502) without any explicit instructions or vulnerable statements in the file. Across six agents and ten underlying models, identifier-level manipulation reached attack success rates of 22.5% to 56.0%, with 75.0% for certain agent-model configurations. The attack outperformed random and neutral renaming and XOXO, and three AI-based and four static analyzers failed to flag the targeted weaknesses in the poisoned files.