Cyber Security News

OpenAI Codex Sandbox Flaws Let Malicious Repositories Execute Commands on Host Systems

OpenAI Codex recently faced two significant security vulnerabilities that allowed malicious repositories to potentially execute commands on a developer’s local system.

These vulnerabilities, identified as Overpatch and Heapjack, were reported to OpenAI on August 12, 2026, and were addressed in under a week.

The more critical issue, Heapjack, emerged when a developer accessed an attacker-controlled repository in Codex and queried the agent about its contents.

This flaw could lead to command execution without any approval prompts or warnings, even when Codex was functioning in its strict read-only sandbox mode.

Overpatch was identified within the open-source Codex CLI and its apply_patch editing tool. In an ideal scenario, Codex should restrict modifications to files only within the active project directory.

However, it was discovered that the apply_patch tool granted permissions based on the parent directories specified in a submitted patch. By incorporating a directory named /tmp in a patch, the tool could mistakenly extend write access starting from the root directory, surpassing the intended workspace limitations.

A proof of concept demonstrated this vulnerability by employing a symbolic link to append a malicious command to the user’s .zshrc file located in the home directory.

Although this specific patch attempt involving /tmp failed because it aimed to overwrite a directory, it still inadvertently expanded the tool’s file-write permissions.

As a result, when the user subsequently opened a terminal, the modified shell configuration could execute code controlled by the attacker beyond the Codex sandbox.

OpenAI Codex Sandbox Flaws

This incident emphasizes that security boundaries should not be determined by paths provided by untrusted content. Since an attacker can influence the patch content, there’s a risk that an editing request could grant access to areas outside the project folder, leading to potential exploitation.

Heapjack impacted the node_repl tool installed by Codex Desktop. Upon installation, Codex Desktop wrote a configuration block to the global ~/.codex/config.toml file, enabling the component’s availability for regular Codex CLI sessions.

DetailOverpatchHeapjack
Affected componentOpenAI Codex CLICodex Desktop node_repl
Sandbox affectedworkspace-writeread-only
Core flawapply_patch widened permissions using attacker-controlled pathsAuthorization token exposed in shared V8 heap
BypassCrafted /tmp path enabled writes outside workspaceHeap inspection recovered the trusted token
ImpactModify host files, including .zshrc, enabling persistenceExecute unsandboxed host commands
Approval requiredNoNo
Fixed versionCodex CLI 0.149.0+Desktop 26.818.21641+

The tool functioned with a parent process written in Rust and a sandboxed Node.js process. In this setup, both trusted OpenAI code and agent-controlled untrusted code operated within separate V8 virtual-machine contexts. The trusted context held a random authorization token meant to verify that requests originated from trusted sources.

The vulnerability arose from the fact that both contexts shared the same V8 isolate and memory heap. An untrusted JavaScript entity could take a heap snapshot and search it for UUID-like strings to locate the valid token.

Once identified, it could send forged requests through the shared standard-output channel to the unsandboxed parent process. These forged requests could potentially invoke the system open command, allowing applications to launch outside of Codex’s intended process structure.

Moreover, the compromised authorization mechanism could enable interactions with Unix sockets, including the Docker daemon socket, or modifications to the global Codex configuration file.

OpenAI responded promptly to these vulnerabilities, addressing Overpatch in Codex CLI version 0.149.0 and Heapjack in Codex Desktop build 26.818.21641.

Users are advised to update both the desktop application and command-line client, particularly if they frequently engage with cloned, third-party, or untrusted repositories.

Ultimately, these vulnerabilities serve as a reminder of overarching security concerns related to AI agents: enforcement logic and sensitive information must remain isolated from environments controlled by untrusted code.

Developers should regard a sandbox as a means to alleviate risk rather than as absolute assurance that content from unfamiliar repositories is safe.

It’s crucial to treat untrusted repositories with caution, maintain up-to-date Codex versions, and not rely solely on read-only mode as protection against potential code execution driven by agents.

Cut every SOC alert investigation by 21 min. Power your SOC with instant IOC context for immediate response: Integrate TI Lookup in your SOC

Abinaya

Abi is a Security Editor and fellow reporter with Cyber Security News. She is covering various cyber security incidents happening in the Cyber Space.

Recent Posts

Critical Apache Struts Vulnerabilities Enables Remote Code Execution Attacks

Four security flaws described in the supplied Apache Struts advisories could expose affected applications to…

51 minutes ago

Former Infrastructure Engineer Sentenced for Sabotaging Employer’s Windows Network

A former infrastructure engineer has been sentenced to 32 months in federal prison for sabotaging…

1 hour ago

GitHub Copilot CLI Vulnerability Lets Attackers Steal Developer Secrets Using Encrypted Prompt Injection

A new GitHub Copilot CLI finding that could allow an attacker-controlled web page to guide…

1 hour ago

From Telemetry to Defense: How SOC and MSSP Leaders Can Build Intelligence-Led Threat Monitoring

Every function in a security operations center, from alert triage to incident response, depends on…

1 hour ago

ASOS Hacked – App Users Receive Notifications Sent by Hackers

ASOS is investigating a cyber incident after customers received an unauthorized app notification claiming hackers…

2 hours ago

Aembit Extends Access Controls to Personal AI Agents

Silver Springs, United States / Maryland, October 6th, 2026, CyberNewswire Aembit, the identity control plane…

2 hours ago