CVE-2026-19591: Codex CLI: PowerShell parsing flaw bypasses approval, RCE

HIGH
Published September 1, 2026
CISO Take

OpenAI's Codex CLI and Codex Desktop contain a command-safety parser that interprets PowerShell's stop-parsing token (--%) differently than PowerShell itself does, letting a maliciously crafted repository trick Codex into running a file-writing Git command without the user's approval. This matters because Codex is an agentic coding tool with 1,063 downstream dependents, and the flaw sits at the boundary between untrusted repository content and an agent's execution privileges — if the write succeeds and later modifies Codex's configuration, the agent can be made to launch an attacker-controlled MCP server and execute code with the user's full account privileges. There is no CISA KEV listing, no public exploit or scanner template, and no EPSS score, so this is not yet under active exploitation, but the multi-step nature (open a hostile repo, have separately-installed PowerShell Core on macOS/Linux, and a permissive filesystem sandbox) means it is realistic in developer environments that clone third-party or open-source code routinely. Security teams should confirm affected Codex CLI/Desktop instances are updated per the fix referenced in openai/codex PR #22643, enforce the default filesystem sandbox on macOS/Linux (it can block the underlying write even if approval is bypassed), and treat Codex config file changes as a detection signal — especially any addition of unexpected MCP server entries. Until patched builds are confirmed deployed, avoid using Codex against untrusted or unreviewed repositories, particularly on hosts with PowerShell Core installed.

Sources:NVDATLASGitHub

What is the risk?

Exploitability is constrained by several preconditions: the user must open an attacker-prepared repository and let Codex act on its embedded instructions, the parser differential must trigger for a specific PowerShell construct, and on macOS/Linux a separately installed PowerShell Core binary is required. The default filesystem sandbox on macOS/Linux is an effective backstop that can prevent the write outside permitted directories, meaningfully reducing real-world blast radius on hardened installs. However, if all conditions align, impact is severe — silent approval bypass leading to persistent config tampering and eventual arbitrary code execution with the user's privileges via an attacker-controlled MCP server. No CVSS score, EPSS data, KEV listing, or public exploit exists yet, so likelihood of opportunistic exploitation today is low, but the technique (indirect prompt injection via repo content + parser inconsistency + agent auto-approval) is a class of bug likely to recur across coding agents. Overall: moderate risk today, high risk if adoption of Codex against untrusted repos is common in the affected population.

How does the attack unfold?

Initial Access
User opens an attacker-prepared repository in Codex CLI/Desktop and Codex follows instructions embedded in the repository content.
AML.T0051.001
Approval Bypass
Codex's command-safety parser misreads a PowerShell command using the --% stop-parsing token and auto-approves a file-writing Git command without user consent.
AML.T0053
Persistence via Config Tampering
If filesystem protections permit the write, the command modifies Codex's own configuration file to point to an attacker-controlled MCP server.
AML.T0081
Impact
On next load, Codex launches the attacker-controlled MCP server and executes code with the user's privileges, enabling read, modify, or delete access to files reachable by that account.
AML.T0112.000

What systems are affected?

PackageEcosystemVulnerable RangePatched
OpenAI Nodenpm—No patch
11.2K1.8K dependentsPushed today56% patched~139d to patchFull package profile →
OpenAI Nodenpm—No patch
11.2K1.8K dependentsPushed today56% patched~139d to patchFull package profile →
OpenAI Nodenpm—No patch
11.2K1.8K dependentsPushed today56% patched~139d to patchFull package profile →

How severe is it?

CVSS 3.1
8.8 / 10
EPSS
0.6%
chance of exploitation in 30 days
Higher than 47% of all CVEs
Exploitation Status
No known exploitation
Sophistication
Advanced

What is the attack surface?

AVACPRUISCIA
AVNetwork
ACLow
PRNone
UIRequired
SUnchanged
CHigh
IHigh
AHigh

What should I do?

1 step
  1. 1) Update Codex CLI and Codex Desktop to the version containing the fix referenced in https://github.com/openai/codex/pull/22643 as soon as it is generally available. 2) Keep the default filesystem sandbox enabled on macOS/Linux — do not grant broad write permissions to Codex sessions, since the sandbox is the last line of defense against the config-tampering step. 3) Avoid installing or invoking PowerShell Core (pwsh) alongside Codex on macOS/Linux unless required, since it is a necessary condition for this exploitation path there. 4) Do not open or run Codex against untrusted or unreviewed repositories, especially ones containing embedded natural-language instructions to the agent. 5) Monitor Codex's configuration file for unexpected changes (new MCP server entries, modified server URLs/binaries) as a detection signal — treat any unapproved MCP server addition as a compromise indicator. 6) Review Codex's command-approval audit trail for file-writing Git operations that were auto-approved without user interaction.

What does CISA's SSVC say?

DecisionTrack
Exploitationnone
AutomatableNo
Technical Impacttotal

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 15-Accuracy, robustness and cybersecurity
ISO 42001
Annex A.6.2.4-Human oversight of AI system decisions
NIST AI RMF
MEASURE 2.7-AI system security and resilience is evaluated and documented
OWASP LLM Top 10
LLM08-Excessive Agency

Frequently Asked Questions

What is CVE-2026-19591?

OpenAI's Codex CLI and Codex Desktop contain a command-safety parser that interprets PowerShell's stop-parsing token (--%) differently than PowerShell itself does, letting a maliciously crafted repository trick Codex into running a file-writing Git command without the user's approval. This matters because Codex is an agentic coding tool with 1,063 downstream dependents, and the flaw sits at the boundary between untrusted repository content and an agent's execution privileges — if the write succeeds and later modifies Codex's configuration, the agent can be made to launch an attacker-controlled MCP server and execute code with the user's full account privileges. There is no CISA KEV listing, no public exploit or scanner template, and no EPSS score, so this is not yet under active exploitation, but the multi-step nature (open a hostile repo, have separately-installed PowerShell Core on macOS/Linux, and a permissive filesystem sandbox) means it is realistic in developer environments that clone third-party or open-source code routinely. Security teams should confirm affected Codex CLI/Desktop instances are updated per the fix referenced in openai/codex PR #22643, enforce the default filesystem sandbox on macOS/Linux (it can block the underlying write even if approval is bypassed), and treat Codex config file changes as a detection signal — especially any addition of unexpected MCP server entries. Until patched builds are confirmed deployed, avoid using Codex against untrusted or unreviewed repositories, particularly on hosts with PowerShell Core installed.

Is CVE-2026-19591 actively exploited?

No confirmed active exploitation of CVE-2026-19591 has been reported, but organizations should still patch proactively.

How to fix CVE-2026-19591?

1) Update Codex CLI and Codex Desktop to the version containing the fix referenced in https://github.com/openai/codex/pull/22643 as soon as it is generally available. 2) Keep the default filesystem sandbox enabled on macOS/Linux — do not grant broad write permissions to Codex sessions, since the sandbox is the last line of defense against the config-tampering step. 3) Avoid installing or invoking PowerShell Core (pwsh) alongside Codex on macOS/Linux unless required, since it is a necessary condition for this exploitation path there. 4) Do not open or run Codex against untrusted or unreviewed repositories, especially ones containing embedded natural-language instructions to the agent. 5) Monitor Codex's configuration file for unexpected changes (new MCP server entries, modified server URLs/binaries) as a detection signal — treat any unapproved MCP server addition as a compromise indicator. 6) Review Codex's command-approval audit trail for file-writing Git operations that were auto-approved without user interaction.

What systems are affected by CVE-2026-19591?

This vulnerability affects the following AI/ML architecture patterns: agent frameworks, CLI-based AI coding agents, MCP tool integrations.

What is the CVSS score for CVE-2026-19591?

CVE-2026-19591 has a CVSS v3.1 base score of 8.8 (HIGH). The EPSS exploitation probability is 0.56%.

What is the AI security impact?

Affected AI Architectures

agent frameworksCLI-based AI coding agentsMCP tool integrations

MITRE ATLAS Techniques

AML.T0050Command and Scripting Interpreter
AML.T0051.001Indirect
AML.T0053AI Agent Tool Invocation
AML.T0081Modify AI Agent Configuration
AML.T0112.000Local AI Agent

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: Annex A.6.2.4
NIST AI RMF: MEASURE 2.7
OWASP LLM Top 10: LLM08

What are the technical details?

Original Advisory

OpenAI Codex CLI for Windows, macOS, and Linux and Codex Desktop for Windows and macOS misclassified certain PowerShell commands as safe because their command-safety parser interpreted PowerShell's stop-parsing token (--%) differently than PowerShell itself. If a user opens an attacker-prepared repository and Codex follows its instructions, Codex can run a file-writing Git command without requesting user approval. On macOS and Linux, exploitation additionally requires separately installed PowerShell Core (pwsh) to be invoked. If filesystem protections permit the write, the command can modify Codex's configuration. If Codex later loads the modified configuration, it can launch an attacker-controlled MCP server and execute code with the user's privileges, allowing it to read, change, or delete files accessible to that account. The approval bypass does not disable filesystem sandboxing; the default filesystem sandbox on macOS and Linux can prevent writes outside permitted locations.

Exploitation Scenario

An attacker publishes or contributes to a public repository containing hidden instructions and a specially crafted PowerShell command using the --% stop-parsing token in a way that Codex's safety parser misreads as benign. A developer opens this repository in Codex CLI/Desktop and asks the agent to review or work on the code; Codex follows the embedded instructions and executes the disguised Git command without prompting for approval, believing it to be safe. On a permissively configured host (or where the sandbox fails to constrain the target path), the command writes to Codex's own configuration file. The next time Codex starts, it loads the tampered configuration and connects to an attacker-controlled MCP server, which then executes arbitrary code with the developer's account privileges — enabling the attacker to read, modify, or delete any files accessible to that user.

Weaknesses (CWE)

CWE-150 — Improper Neutralization of Escape, Meta, or Control Sequences: The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component.

  • Developers should anticipate that escape, meta and control characters/sequences will be injected/removed/manipulated in the input vectors of their product. Use an appropriate combination of denylists and allowlists to ensure only valid, expected and appropriate input is processed by the system.
  • [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylis

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Timeline

Published
September 1, 2026
Last Modified
September 2, 2026
First Seen
September 1, 2026

Related Vulnerabilities