This post is also available in:
עברית (Hebrew)
AI-powered code assistants have become widely integrated into development environments, improving efficiency through features like code generation, auto-completion and test writing. However, new research highlights growing security concerns around these tools—particularly their vulnerability to indirect manipulation by attackers.
According to Unit 42, the cybersecurity division of Palo Alto Networks, threat actors are increasingly finding ways to exploit AI code assistants by manipulating the content they rely on. A recently published report outlines how these tools can be compromised without direct access to a user’s device, simply by targeting the data streams the AI draws from.
One of the main concerns is indirect prompt injection. This occurs when malicious prompts are hidden in external sources—such as websites, APIs, or public repositories—that the AI assistant is designed to reference or analyze. Because large language models (LLMs) do not reliably differentiate between user input and system instructions, poisoned content can cause the assistant to perform unintended or even harmful actions.
A second major vulnerability involves context attachments, where developers provide external links or files to help guide the assistant’s output. These sources—intended to enrich the assistant’s understanding—could be compromised, particularly if they originate from popular yet vulnerable repositories. The AI, treating the context as a prompt, processes this content before the actual user query, increasing the risk of exploitation.
For example, Unit 42 demonstrated how a manipulated social media post could lead an AI assistant to generate backdoored code when asked to analyze online data. Developers who copy and paste or automatically apply the suggested code may inadvertently execute malicious instructions.
As AI assistants continue to evolve, the researchers urge users to carefully review any generated code, especially when it’s based on external inputs. They also recommend strict oversight of context data and avoiding overreliance on automated suggestions.
Ultimately, while AI tools offer productivity gains, they also introduce new attack surfaces that developers and security teams must actively monitor.