CVE-2025-59532: @openai/codex Codex Has Sandbox Bypass Due Vulnerability

HIGH
Advisory Identifier: GHSA-w5fx-fh39-j5rw
CWE-20
Published
Advisory Summary

CVE-2025-59532 is a HIGH codex has sandbox bypass due vulnerability (CWE-20: Improper Input Validation) affecting @openai/codex libraries in the npm ecosystem. The issue involves codex has sandbox bypass due to bug in path configuration logic. Remediation is available by upgrading affected packages to version 0.39.0.

CVE-2025-59532 at a Glance

CVE Identifier CVE-2025-59532
GHSA Identifier GHSA-w5fx-fh39-j5rw
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-20: Improper Input Validation
Affected Product @openai/codex
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-59532

To remediate this vulnerability, upgrade all affected @openai/codex dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@openai/codex fixed: 0.39.0
npm install @openai/codex@0.39.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @openai/codex

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-59532, inspect your project dependencies using npm:

npm ls @openai/codex

Analyze the terminal output to locate any version of @openai/codex in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.39.0), your application is affected.

Note: The npm ls @openai/codex command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In @openai/codex, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Due to a bug in the sandbox configuration logic, Codex CLI could treat a model-generated `cwd` as the sandbox’s writable root, including paths outside of the folder where the user started their session. This logic bypassed the intended workspace boundary and enables arbitrary file writes and command execution where the Codex process has permissions - this did not impact the network-disabled sandbox restriction. **Remediation** We released a patch in Codex CLI **0.39.0** that canonicalizes and validates that the boundary used for sandbox policy is based on where the user started the session, and not the one generated by the model. Users running 0.38.0 or earlier should update immediately via their package manager or by reinstalling the latest Codex CLI to ensure sandbox boundaries are enforced. If using the Codex IDE extension, users should immediately update to **0.4.12** for a fix of the sandbox issue. Thank you to Tzanko Matev (Codetracer) for reporting the issue!

CVE-2025-59532 Affected @openai/codex Versions

1 component(s)
Fixed Versions:
0.39.0
Product / Package Ecosystem Affected Versions Fixed Version
@openai/codex
npm
≥ 0.2.0
< 0.39.0
0.39.0

References

Frequently Asked Questions

What is CVE-2025-59532?
CVE-2025-59532 is a security vulnerability in @openai/codex involving Codex has sandbox bypass due to bug in path configuration logic under CWE-20: Improper Input Validation.
Which @openai/codex versions are affected?
Affected versions include releases prior to 0.39.0 across affected packages: @openai/codex.
What version fixes CVE-2025-59532?
Upgrading to 0.39.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @openai/codex affected?
Yes, @openai/codex is affected in releases prior to 0.39.0. Upgrade your dependency to 0.39.0 or later.
What CWE is associated with CVE-2025-59532?
CVE-2025-59532 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2025-59532?
Run the dependency tree command: 'npm ls @openai/codex'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w5fx-fh39-j5rw",
  "modified" : "2025-09-22T21:59:01Z",
  "published" : "2025-09-19T17:14:04Z",
  "aliases" : [ "CVE-2025-59532" ],
  "summary" : "Codex has sandbox bypass due to bug in path configuration logic",
  "details" : "Due to a bug in the sandbox configuration logic, Codex CLI could treat a model-generated `cwd` as the sandbox’s writable root, including paths outside of the folder where the user started their session.\n\nThis logic bypassed the intended workspace boundary and enables arbitrary file writes and command execution where the Codex process has permissions - this did not impact the network-disabled sandbox restriction.\n\n**Remediation**\nWe released a patch in Codex CLI **0.39.0** that canonicalizes and validates that the boundary used for sandbox policy is based on where the user started the session, and not the one generated by the model. Users running 0.38.0 or earlier should update immediately via their package manager or by reinstalling the latest Codex CLI to ensure sandbox boundaries are enforced.\n\nIf using the Codex IDE extension, users should immediately update to **0.4.12** for a fix of the sandbox issue.\n\nThank you to Tzanko Matev (Codetracer) for reporting the issue!",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@openai/codex"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.2.0"
      }, {
        "fixed" : "0.39.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.38.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/openai/codex/security/advisories/GHSA-w5fx-fh39-j5rw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-59532"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openai/codex/commit/8595237505a1e0faabc2af3db805b66ce3ae182d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/openai/codex"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openai/codex/releases/tag/rust-v0.39.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-09-19T17:14:04Z",
    "nvd_published_at" : "2025-09-22T21:16:00Z"
  }
}