OpenAI Codex CLI Symlink Arbitrary File Overwrite Vulnerability Leading to Potential Remote Code Execution

Vulnerability

A vulnerability in the OpenAI Codex CLI has been identified, specifically in versions prior to 0.12.0. When used in workspace-write mode within a malicious context, such as a compromised repository or directory, the CLI can unintentionally overwrite arbitrary files. This issue arises because the CLI follows symlinks that point outside the permitted working directory, potentially leading to remote code execution.

Impact

Exploitation of this vulnerability allows for arbitrary file overwriting, with the possibility of remote code execution due to the overwritten file being executed as a script.

Reproduction

To reproduce this vulnerability, create a symlink in the current working directory that points to a file in a writable directory outside the Codex CLI sandbox. Then, run the Codex CLI in workspace-write mode, which will follow the symlink and overwrite the original file with new data. This can be done by initiating a prompt injection that instructs Codex to create a file, which will instead write to the symlinked file outside the intended sandbox.

Remediation

Users can update to Codex CLI version 0.12.0 or later, where this vulnerability has been addressed.

Added: Sep 1, 2025, 7:22 PM
Updated: Sep 1, 2025, 7:22 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
10.0
exploitability
4.6
remediation
0.0
relevance
0.3
threat
6.4
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.