Hutchinson Kansas Newspaper

collapse
Home / Daily News Analysis / How malicious downloads can trick AI coding agents into compromising themselves

How malicious downloads can trick AI coding agents into compromising themselves

Oct 27, 2026  Twila Rosenbaum 47 views
How malicious downloads can trick AI coding agents into compromising themselves

Malicious instruction files planted in a computer’s Downloads folder can trick AI coding agents into executing harmful code or exposing authentication tokens, according to a security research team that blocked an attempted attack on a customer’s machine and demonstrated similar techniques against OpenAI’s Codex and Anthropic’s Claude Code.

In its research report, the firm said it discovered a malicious AGENTS.md file in a customer’s Downloads folder that instructed Codex to install a malicious npm package called function-color. The installation was blocked before the malware could execute. The researchers could not determine how the original file reached the computer, but they demonstrated that a malicious website could trigger a similar download without a separate approval prompt.

Key facts at a glance

  • A security research team found a malicious AGENTS.md file in a customer’s Downloads folder that instructed OpenAI’s Codex to install a malicious npm package named function-color.
  • The installation was blocked before the malware could run, but researchers could not determine how the file initially reached the machine.
  • The team demonstrated that a malicious website could trigger a similar download without a separate approval prompt.
  • Codex uses AGENTS.md and Anthropic’s Claude Code supports CLAUDE.md; both can interpret instructions in these Markdown files when operating in directories where they are present.
  • In tests, Codex followed the malicious instructions in more than 90% of runs, most using a harmless malware substitute.
  • Codex was manipulated into modifying its machine-wide MCP server configuration and launching another session with approval and sandbox restrictions bypassed.
  • A malicious CLAUDE.md file redirected Claude Code API traffic to a researcher-controlled server, exposing authentication tokens; configuration manipulation succeeded in about half the tests.
  • Researchers replayed a captured OAuth token against the legitimate API, showing potential account compromise.
  • The Markdown files contain no executable code; the attack depends on agents interpreting them as legitimate instructions and acting with existing permissions.
  • Experts recommend human approval, origin verification, sandboxing, network restrictions, internal package registries, and treating instruction files like source code.

How the attack works

The attack exploits the way AI coding assistants process project-specific instructions. Codex uses AGENTS.md, while Claude Code supports CLAUDE.md. Both can interpret instructions contained in these Markdown files when operating in directories where the files are present. The attack requires the agent to operate in the affected directory and process the malicious file. For Codex, the directory must also be trusted, according to the research team.

In tests using the file recovered from the customer’s machine, the researchers found that Codex could be manipulated into modifying its machine-wide MCP server configuration and launching another session with approval and sandbox restrictions bypassed. Codex followed the malicious instructions in more than 90% of tests, most of which used a harmless substitute for the malware. Because the malicious server was registered in Codex’s machine-wide configuration, it could also be loaded in subsequent sessions, even after the developer moved to another directory.

A separate demonstration against Claude Code showed that a malicious CLAUDE.md file could redirect the agent’s API traffic to a researcher-controlled server, exposing authentication tokens and allowing the server to supply commands for execution. The configuration manipulation succeeded in approximately half of the tests. The researchers also successfully replayed a captured OAuth token against the legitimate API, demonstrating the potential for account compromise.

The Markdown files contain no executable code. Instead, the attack relies on an AI agent interpreting their contents as legitimate instructions and carrying them out with its existing permissions. That distinction is central to the risk: the malicious file does not need to exploit a memory corruption bug or a traditional software vulnerability. It simply needs to persuade the agent that the instructions are part of the project’s normal workflow.

Why AI coding agents are vulnerable

The findings expose a broader design problem in AI coding agents, which are expected to follow project instructions but may also have access to sensitive configurations and execution privileges, according to Akshat Tyagi, associate practice leader at HFS Research.

“The deeper issue is that these tools treat following an instruction and granting a privilege as the same act,” Tyagi said. He argued that vendors must separate the two, ensuring that instructions from project files cannot authorize changes to an agent’s security settings without independent human approval.

Grover said vendors should verify the origin of instruction files and require explicit approval before loading those from untrusted sources, rather than automatically treating them as authoritative. Attackers could adapt the technique to other locations accessible to coding agents, including cloned repositories, shared drives, and package contents.

“The more consequential risk is not Downloads specifically but the broader pattern of agents ingesting untrusted content and holding live credentials,” Grover said.

Industry reaction and risk assessment

Commenting on the findings, Sakshi Grover, senior research manager for cybersecurity products and services for Asia/Pacific at IDC, said the research was a credible early warning rather than evidence of widespread exploitation. She noted that the reported success rates varied between agents and had not been independently validated.

The results are likely to sharpen scrutiny of agentic development tools, which have moved quickly from autocomplete-style assistants to systems that can plan multi-step changes, run commands, install dependencies, and interact with external services. That shift has made productivity gains possible, but it has also widened the attack surface. A conventional code editor does not usually decide on its own to install a package or rewrite a security configuration. An AI coding agent may do so if it believes the action is part of the task.

Security teams have spent years adapting to risks such as malicious dependencies, compromised build pipelines, and credential leakage. Agent instruction files add a new layer because they combine natural-language persuasion with the agent’s existing authority. The agent does not need a software exploit; it needs a plausible reason to act. That makes detection harder, because the resulting behavior may look like ordinary development work until the moment a package is installed or a token is sent to an external server.

Enterprise confidence gap

The findings come amid uncertainty over enterprises’ ability to secure autonomous agents. An Omdia Cybersecurity Decision-Maker survey found that 40% of respondents were only somewhat confident or not confident in their organizations’ ability to secure AI agents, according to Jonathan Ong, senior analyst for managed security services at Omdia.

Ong recommended human oversight to identify suspicious agent behavior and restrictions on settings that allow agents to bypass security controls. “Disabling flags such as ‘–dangerously-bypass-approvals-and-sandbox’ would limit the agent’s authorization to run high-risk actions,” Ong said.

Practical defenses

Amit Kumar Jena, development manager for AI at Kanerika, recommended treating agent instruction files like source code, with designated owners reviewing changes to AGENTS.md, CLAUDE.md and related configuration directories.

He also advised keeping sandboxes enabled, restricting network access, and routing software installations through internal package registries or scanning proxies. For developers with production credentials on their machines, he recommended isolated development environments and enterprise-controlled gateways with shorter-lived authentication tokens.

“An instruction file can change what the agent tries,” Jena said. “It must never change what the agent is allowed to do.”


Source:InfoWorld News


Share:

Your experience on this site will be improved by allowing cookies Cookie Policy