CVE-2026-25129: Psy/psysh PsySH Has Local Privilege Escalation Vulnerability

MODERATE
Advisory Identifier: GHSA-4486-gxhx-5mg7
CVSS 6.7
CWE-427
Published
Advisory Summary

CVE-2026-25129 is a MODERATE (CVSS 6.7) psysh has local privilege escalation vulnerability (CWE-427: Uncontrolled Search Path Element) affecting Psy/psysh libraries in the Packagist ecosystem. The issue involves psysh has local privilege escalation via cwd .psysh.php auto-load. Remediation is available by upgrading affected packages to version 0.12.19, 0.11.23.

CVE-2026-25129 at a Glance

CVE Identifier CVE-2026-25129
GHSA Identifier GHSA-4486-gxhx-5mg7
Severity MODERATE
CVSS v3.1 Base Score 6.7
CWE Classification CWE-427: Uncontrolled Search Path Element
Affected Product Psy/psysh
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 6.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-25129

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

psy/psysh fixed: 0.12.19
Upgrade psy/psysh to 0.12.19
psy/psysh fixed: 0.11.23
Upgrade psy/psysh to 0.11.23
Verify Direct and Transitive Dependencies

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

inspect dependencies for psy/psysh

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-25129, inspect your project dependencies for Psy/psysh:

inspect dependencies for psy/psysh

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-427: Uncontrolled Search Path Element, where the product uses a fixed or controlled search path to find resources, but one or more locations in that path can be under the control of unintended actors. In Psy/psysh, 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

### Summary PsySH automatically loads and executes a `.psysh.php` file from the Current Working Directory (CWD) on startup. If an attacker can write to a directory that a victim later uses as their CWD when launching PsySH, the attacker can trigger arbitrary code execution in the victim's context. When the victim runs PsySH with elevated privileges (e.g., root), this results in local privilege escalation. ### Details PsySH supports per-directory configuration via a `.psysh.php` file located in the process CWD. This file is executed implicitly when PsySH starts, without requiring explicit opt-in and without validating that the file and directory are safe (e.g., owned by the current user and not group/world-writable). This enables a CWD poisoning scenario: a low-privileged user can plant a malicious `.psysh.php` in any directory they can write to, then wait for a higher-privileged user to start PsySH while their shell is in that directory. ### PoC 1. As a low-privileged user, create a malicious `.psysh.php` in an attacker-writable directory (example: `/tmp`): ```bash bob@localhost:/tmp$ echo "<?php system('id > poc.txt'); ?>" > .psysh.php bob@localhost:/tmp# ls -lah .psysh.php -rw-r--r-- 1 bob bob 33 Jan 28 11:17 .psysh.php ``` 2. As the victim user, start PsySH with CWD set to that directory and exit: ```bash root@localhost:/tmp# cd /tmp root@localhost:/tmp# ./psysh Psy Shell v0.12.18 (PHP 8.1.2-1ubuntu2.23 — cli) by Justin Hileman New PHP manual is available (latest: 3.0.1). Update with `doc --update-manual` > exit INFO Goodbye. ``` 3. Verify code execution triggered in the victim context: ```bash bob@localhost:/tmp$ ls -lah poc.txt -rw-r--r-- 1 root root 39 Jan 28 11:19 poc.txt bob@localhost:/tmp$ cat poc.txt uid=0(root) gid=0(root) groups=0(root) ```` ### Impact This is a CWD configuration poisoning issue leading to arbitrary code execution in the victim user’s context. If a privileged user (e.g., root, a CI runner, or an ops/debug account) launches PsySH with CWD set to an attacker-writable directory containing a malicious `.psysh.php`, the attacker can execute commands with that privileged user’s permissions, resulting in local privilege escalation. Downstream consumers that embed PsySH inherit this risk. For example, Laravel Tinker (`php artisan tinker`) uses PsySH. If a privileged user runs Tinker while their shell is in an attacker-writable directory, the `.psysh.php` auto-load behavior can be abused in the same way to execute attacker-controlled code under the victim’s privileges.

CVE-2026-25129 Affected Psy/psysh Versions

2 component(s)
Fixed Versions:
0.12.190.11.23
Product / Package Ecosystem Affected Versions Fixed Version
psy/psysh
Packagist
≥ 0.12.0
< 0.12.19
0.12.19
psy/psysh
Packagist
< 0.11.23
0.11.23

References

Frequently Asked Questions

What is CVE-2026-25129?
CVE-2026-25129 is a security vulnerability in Psy/psysh involving PsySH has Local Privilege Escalation via CWD .psysh.php auto-load under CWE-427: Uncontrolled Search Path Element.
Which Psy/psysh versions are affected?
Affected versions include releases prior to 0.12.19, 0.11.23 across affected packages: psy/psysh.
What version fixes CVE-2026-25129?
Upgrading to 0.12.19, 0.11.23 (or the latest patched release for your respective branch) resolves the vulnerability.
Is psy/psysh affected?
Yes, psy/psysh is affected in releases prior to 0.12.19, 0.11.23. Upgrade your dependency to 0.12.19, 0.11.23 or later.
What is the CVSS score of CVE-2026-25129?
CVE-2026-25129 has a CVSS v3.1 base score of 6.7 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-25129?
CVE-2026-25129 is classified under CWE-427: Uncontrolled Search Path Element (The product uses a fixed or controlled search path to find resources, but one or more locations in that path can be under the control of unintended actors.).
How can I check Packagist dependencies for CVE-2026-25129?
Run the dependency tree command: 'inspect dependencies for psy/psysh'. 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-4486-gxhx-5mg7",
  "modified" : "2026-01-31T03:54:31Z",
  "published" : "2026-01-30T21:28:44Z",
  "aliases" : [ "CVE-2026-25129" ],
  "summary" : "PsySH has Local Privilege Escalation via CWD .psysh.php auto-load",
  "details" : "### Summary\nPsySH automatically loads and executes a `.psysh.php` file from the Current Working Directory (CWD) on startup. If an attacker can write to a directory that a victim later uses as their CWD when launching PsySH, the attacker can trigger arbitrary code execution in the victim's context. When the victim runs PsySH with elevated privileges (e.g., root), this results in local privilege escalation.\n\n### Details\nPsySH supports per-directory configuration via a `.psysh.php` file located in the process CWD. This file is executed implicitly when PsySH starts, without requiring explicit opt-in and without validating that the file and directory are safe (e.g., owned by the current user and not group/world-writable).\n\nThis enables a CWD poisoning scenario: a low-privileged user can plant a malicious `.psysh.php` in any directory they can write to, then wait for a higher-privileged user to start PsySH while their shell is in that directory.\n\n### PoC\n1. As a low-privileged user, create a malicious `.psysh.php` in an attacker-writable directory (example: `/tmp`):\n\n```bash\nbob@localhost:/tmp$ echo \"<?php system('id > poc.txt'); ?>\" > .psysh.php\nbob@localhost:/tmp# ls -lah .psysh.php\n-rw-r--r-- 1 bob bob 33 Jan 28 11:17 .psysh.php\n```\n\n2. As the victim user, start PsySH with CWD set to that directory and exit:\n\n```bash\nroot@localhost:/tmp# cd /tmp\nroot@localhost:/tmp# ./psysh\nPsy Shell v0.12.18 (PHP 8.1.2-1ubuntu2.23 — cli) by Justin Hileman\nNew PHP manual is available (latest: 3.0.1). Update with `doc --update-manual`\n> exit\n\n   INFO  Goodbye.\n\n```\n\n3. Verify code execution triggered in the victim context:\n\n```bash\nbob@localhost:/tmp$ ls -lah poc.txt\n-rw-r--r-- 1 root root 39 Jan 28 11:19 poc.txt\nbob@localhost:/tmp$ cat poc.txt\nuid=0(root) gid=0(root) groups=0(root)\n````\n\n\n### Impact\n\nThis is a CWD configuration poisoning issue leading to arbitrary code execution in the victim user’s context. If a privileged user (e.g., root, a CI runner, or an ops/debug account) launches PsySH with CWD set to an attacker-writable directory containing a malicious `.psysh.php`, the attacker can execute commands with that privileged user’s permissions, resulting in local privilege escalation.\n\nDownstream consumers that embed PsySH inherit this risk. For example, Laravel Tinker (`php artisan tinker`) uses PsySH. If a privileged user runs Tinker while their shell is in an attacker-writable directory, the `.psysh.php` auto-load behavior can be abused in the same way to execute attacker-controlled code under the victim’s privileges.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "psy/psysh"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.12.0"
      }, {
        "fixed" : "0.12.19"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.12.18"
    }
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "psy/psysh"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.11.23"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.11.22"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/bobthecow/psysh/security/advisories/GHSA-4486-gxhx-5mg7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-25129"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/bobthecow/psysh"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bobthecow/psysh/releases/tag/v0.11.23"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bobthecow/psysh/releases/tag/v0.12.19"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-427" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-01-30T21:28:44Z",
    "nvd_published_at" : "2026-01-30T21:15:58Z"
  }
}