CVE-2026-25129
Unknown Unknown - Not Provided
CWD Poisoning in PsySH Allows Local Privilege Escalation

Publication date: 2026-01-30

Last updated on: 2026-02-27

Assigner: GitHub, Inc.

Description
PsySH is a runtime developer console, interactive debugger, and REPL for PHP. Prior to versions 0.11.23 and 0.12.19, 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. 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. Versions 0.11.23 and 0.12.19 patch the issue.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-01-30
Last Modified
2026-02-27
Generated
2026-05-07
AI Q&A
2026-01-30
EPSS Evaluated
2026-05-05
NVD
Affected Vendors & Products
Showing 2 associated CPEs
Vendor Product Version / Range
psysh psysh to 0.11.23 (exc)
psysh psysh From 0.12.0 (inc) to 0.12.19 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-427 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.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

CVE-2026-25129 is a vulnerability in PsySH, a PHP REPL tool, where PsySH automatically loads and executes a .psysh.php file from the Current Working Directory (CWD) on startup without validating the file's ownership or permissions. If an attacker can write a malicious .psysh.php file into a directory that a victim later uses as their CWD when launching PsySH, the attacker can execute arbitrary code in the victim's context. This can lead to local privilege escalation if the victim runs PsySH with elevated privileges. The issue affects PsySH versions prior to 0.11.23 and 0.12.19 and also impacts downstream tools like Laravel Tinker that embed PsySH. The vulnerability arises from a CWD configuration poisoning scenario where PsySH implicitly trusts and executes the .psysh.php file found in the CWD without proper validation. [1, 2]


How can this vulnerability impact me? :

This vulnerability can allow an attacker with write access to a directory to plant a malicious .psysh.php file. When a victim, especially a privileged user such as root, runs PsySH or a downstream tool like Laravel Tinker with their CWD set to that directory, the malicious code executes with the victim's privileges. This results in arbitrary code execution and local privilege escalation, potentially allowing the attacker to execute commands as the victim user, compromise system integrity, confidentiality, and availability. [1, 2]


How can this vulnerability be detected on my network or system? Can you suggest some commands?

This vulnerability can be detected by checking if PsySH or downstream tools like Laravel Tinker are being run from directories writable by untrusted users, especially if those directories contain a malicious `.psysh.php` file. A practical detection method is to look for `.psysh.php` files in directories where privileged users run PsySH or Tinker, particularly in temporary or shared writable directories such as `/tmp`. You can use commands like `find /path/to/check -name '.psysh.php'` to locate such files. Additionally, verifying directory permissions with commands like `ls -ld /path/to/check` can help identify writable directories that pose a risk. Monitoring for unexpected execution of PsySH or Laravel Tinker from untrusted directories may also indicate exploitation attempts. [2]


What immediate steps should I take to mitigate this vulnerability?

Immediate mitigation steps include upgrading PsySH to version 0.11.23 or 0.12.19 or later, where the vulnerability is patched. These versions introduce a Restricted Mode that requires explicit trust before loading project-local `.psysh.php` files or other local configurations. You can configure trust settings using the `trustProject` option, CLI flags `--trust-project` / `--no-trust-project`, or the environment variable `PSYSH_TRUST_PROJECT`. Additionally, avoid running PsySH or downstream tools like Laravel Tinker from directories writable by untrusted users. Ensuring that privileged users do not launch PsySH from attacker-writable directories will prevent exploitation. Removing or auditing `.psysh.php` files in writable directories is also recommended. [1, 3]


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart