CVE-2026-25129
CWD Poisoning in PsySH Allows Local Privilege Escalation
Publication date: 2026-01-30
Last updated on: 2026-02-27
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| 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 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]