{"id":"CVE-2026-25129","aliases":["CVE-2026-25129","GHSA-4486-gxhx-5mg7"],"related":[],"kind":"vulnerability","state":"published","title":"PsySH has Local Privilege Escalation via CWD .psysh.php auto-load","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"PsySH es una consola de desarrollador en tiempo de ejecución, depurador interactivo y REPL para PHP. Antes de las versiones 0.11.23 y 0.12.19, PsySH carga y ejecuta automáticamente un archivo '.psysh.php' desde el Directorio de Trabajo Actual (CWD) al inicio. Si un atacante puede escribir en un directorio que una víctima usa posteriormente como su CWD al iniciar PsySH, el atacante puede desencadenar la ejecución de código arbitrario en el contexto de la víctima. Cuando la víctima ejecuta PsySH con grandes privilegios (por ejemplo, root), esto resulta en una escalada de privilegios local. Este es un problema de envenenamiento de la configuración del CWD que conduce a la ejecución de código arbitrario en el contexto del usuario víctima. Si un usuario privilegiado (por ejemplo, root, un ejecutor de CI o una cuenta de operaciones/depuración) inicia PsySH con el CWD configurado en un directorio escribible por el atacante que contiene un '.psysh.php' malicioso, el atacante puede ejecutar comandos con los permisos de ese usuario privilegiado, lo que resulta en una escalada de privilegios local. Los consumidores posteriores que incrustan PsySH heredan este riesgo. Por ejemplo, Laravel Tinker (php artisan tinker) usa PsySH. Si un usuario privilegiado ejecuta Tinker mientras su shell está en un directorio escribible por el atacante, el comportamiento de carga automática del '.psysh.php' puede ser abusado de la misma manera para ejecutar código controlado por el atacante bajo los privilegios de la víctima. Las versiones 0.11.23 y 0.12.19 resuelven el problema.","source":"nvd"}],"published":"2026-01-30T20:12:48.651Z","modified":"2026-06-17T10:24:09.540Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","score":6.7,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","score":6.7,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","score":6.7,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","score":7.3,"rating":"HIGH"}],"cwes":["CWE-427"],"affected":[{"ranges":[{"version":"< 0.11.23","status":"affected"},{"version":">= 0.12.0, < 0.12.19","status":"affected"}],"vendor":"bobthecow","product":"psysh","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0.12.0","status":"affected","fixed":"0.12.19"}],"ecosystem":"Packagist","package":"psy/psysh","purl":"pkg:composer/psy/psysh","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.11.23"}],"ecosystem":"Packagist","package":"psy/psysh","purl":"pkg:composer/psy/psysh","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.11.23"},{"status":"affected","introduced":"0.12.0","fixed":"0.12.19"}],"vendor":"psysh","product":"psysh","cpe":"cpe:2.3:a:psysh:psysh:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/bobthecow/psysh/security/advisories/GHSA-4486-gxhx-5mg7","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/bobthecow/psysh/releases/tag/v0.11.23","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/bobthecow/psysh/releases/tag/v0.12.19","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25129","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/bobthecow/psysh","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-02-02T15:44:26.134Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-25129","url":"https://www.cve.org/CVERecord?id=CVE-2026-25129","licence":"CVE Terms of Use","modified":"2026-02-02T15:45:55.276Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-4486-gxhx-5mg7","url":"https://github.com/advisories/GHSA-4486-gxhx-5mg7","licence":"CC-BY-4.0","modified":"2026-02-03T03:13:39.153Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-25129","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25129","licence":"Public domain","modified":"2026-06-17T10:24:09.540Z"}],"updatedAt":"2026-11-25T22:59:13.325Z","epss":{"score":0.00322,"percentile":0.27206,"date":"2026-12-01T12:00:22.000Z"}}