AttackResearch disclosureCodex CLI on Windows

A web search that ended in code running on the host

Cymulate showed that a prompt injection delivered through Codex CLI’s web-search tool could make the agent write a file named like a developer tool into the workspace. Windows then resolved that file ahead of the real tool, and it ran on the host, outside the sandbox.

By the NoFly team

What NoFly would decideIllustrative
Waiting for a personCodex CLI hook
Write(file_path: "node.exe", …)
Agent
Codex · workspace
Came from
Instructions carried in a web-search result
Rule
Plants a developer-tool executable in the working directory
Why
Windows resolves node from the working directory before the system path, so this file would run in place of node.
Approve onceDenyAn unanswered hold expires as a no

What happened

Cymulate Research Labs disclosed the chain for Codex CLI on Windows on 4 June 2026, as part three of a series on AI agent applications. Codex ships on Windows as a native binary with Rust and Node.js components.

A prompt injection, carried in the results of the agent’s own web-search tool, steered it into writing a malicious helper into the workspace. On Windows, editors and tools built on Node look for a helper such as git or node in the working directory before the system path, so the next time the agent ran that tool by name, Windows ran the planted file instead, outside the sandbox and with no prompt.

Cymulate’s advice was to audit workspaces for unexpected executables, tighten file-write permissions, and watch agent activity, while noting that these reduce risk rather than close the flaw. The pattern, a file that looks inert until a trusted tool resolves it, runs through several of 2026’s coding-agent disclosures.

  1. 01

    A web search returns results carrying hidden instructions.

  2. 02

    The agent writes a file named like a developer tool into the workspace.

  3. 03

    The agent later runs that tool by name.

  4. 04

    Windows resolves the planted file first and runs it on the host.

Why it worked

Probable cause

The working directory was on the executable search path ahead of the system path, and the agent could write to it on instructions that rode in through a tool result.

How NoFly stops it

  • Protect

    A write whose target is an executable named like a developer tool (git, node, npm and the rest), landing in the directory the agent works in, is held for a person. The same shape is caught when it arrives as a download or a copy rather than a direct write.

  • Discover

    A repository that already carries a tool-named executable at its top level is flagged before anyone opens it, so a planted binary that travels with a clone is found by the scan, not by running it.

  • Protect

    The tool result that carried the instructions is screened before the agent acts on it, so the injection is caught at the step where it enters.

What to do this week

This week3 actions
  1. Treat tool results, including web-search output, as untrusted input, not instructions.
  2. Keep developer-tool binaries out of the workspace, and call tools by absolute path where you can.
  3. Scan repositories for tool-named executables before opening them in an agent on Windows.
Keep reading

More from the blog.

Find out what your AI is allowed to do today.

Book a call and we will map your agents, MCP servers and keys with you, or start on one laptop with the free scan.

Book a demo
npm i -g @nofly/agent