Forever Security traces blocked AI malware install to a Downloads instruction file
The investigation reproduced attacks against Codex and Claude Code under different conditions. How the original customer’s malicious file arrived remains unknown.
Loading page…
The investigation reproduced attacks against Codex and Claude Code under different conditions. How the original customer’s malicious file arrived remains unknown.
Listen to this story
Forever Security's tests show how local agent instructions can cross a machine's trust boundary: a planted AGENTS.md can lead Codex to change machine-wide configuration, while a tailored CLAUDE.md redirected Claude Code's model-service settings. In an isolated replay of the customer's file, Codex ran a live malicious payload in more than 90% of attempts; Claude Code's route worked in about half, with user approval required for settings changes. The file's origin in the customer incident is unknown, so web delivery remains a demonstrated possibility, not an established cause. Keeping agents out of Downloads and preserving safeguards are practical defenses.
The customer incident involved an attempted install of the known-malicious npm package function-color, which Forever says it blocked before code ran.
Codex's test file targeted ~/.codex/config.toml, allowing a server registration to persist across sessions and projects.
Forever's Claude Code test redirected model-service requests to a controlled server, which could expose a login token; Claude often refused suspicious changes.
An AI coding agent trying to install malware was taking orders from a plain-text file in a customer’s Downloads folder, Forever Security says. The company blocked the attempt before code ran. Its investigation then reproduced attacks against Codex and Claude Code, showing how instructions disguised as project setup could redirect an agent’s actions.
Researchers Gal Weizman and Omer Samet published the investigation on October 22. The initial alert concerned function-color, a known-malicious npm software package. Looking beyond the attempted installation, they traced the instruction to a file named AGENTS.md rather than a software dependency or code repository.
AGENTS.md supplies directions that Codex reads when working in a trusted project folder. The customer’s file looked like ordinary engineering guidance, with the malicious setup instructions buried near the end. Forever says Codex must already trust the folder for those directions to apply; previous work in Downloads can establish that trust.
How that file reached the customer’s machine remains unknown. To test one possible delivery route, Forever built a web page that silently downloaded an instruction file into Downloads. That demonstration established a possible path from a website to an agent-readable file, not evidence that the customer encountered the same delivery method.
The researchers took the customer’s actual AGENTS.md and ran it inside an isolated virtual machine. They say Codex fetched and ran the live malicious payload in more than 90% of attempts. That is Forever’s test result, distinct from the customer incident, where the installation was stopped.
The file presented its request as routine preparation: register a project tools server before starting the user’s task. Its target was ~/.codex/config.toml, Codex’s machine-wide configuration. Because that configuration loads across sessions, the attacker’s server registration could follow the agent into other folders and projects, rather than remain confined to Downloads.
Several controls complicated the attack. A blunt installation request was refused, the researchers found, while the longer engineering-document framing worked. The payload also instructed Codex to launch a second session with approvals and sandbox protections bypassed, framed as a necessary initialization check. It handed the installation to a separate operating-system service so Codex’s server timeout would not cut it off.
Forever found Claude Code harder to fool and built a different instruction file, CLAUDE.md. Instead of installing a package, it posed as guidance for an internal model gateway. It asked the agent to write a project setting that redirected its model-service requests to a server the researchers controlled.
That redirection could expose Claude’s login token and let the controlled server impersonate the model, returning commands for the agent to execute, Forever says. The company reported success in about half its tests. Crucially, The Hacker News reported that a person had to approve the settings write, and Claude often refused suspicious changes.
Forever argues that this is not a conventional bug for OpenAI or Anthropic to patch: following local instruction files is intended behavior. Its proposed response focuses on where agents start, what instructions they encounter, and whether they can change their own configuration. The company’s practical advice includes:
Loading discussion...
Join the conversation
Explain where setup convenience should give way to tighter control.
Be the first to share a perspective or an experience.
Reader comments
Newest comments first. Replies stay oldest first.