7.0
HIGH CVSS 4.0
CVE-2025-59042
PyInstaller has local privilege escalation vulnerability
Description

PyInstaller bundles a Python application and all its dependencies into a single package. Due to a special entry being appended to `sys.path` during the bootstrap process of a PyInstaller-frozen application, and due to the bootstrap script attempting to load an optional module for bytecode decryption while this entry is still present in `sys.path`, an application built with PyInstaller < 6.0.0 may be tricked by an unprivileged attacker into executing arbitrary python code when **all** of the following conditions are met. First, the application is built with PyInstaller < 6.0.0; both onedir and onefile mode are affected. Second, the optional bytecode encryption code feature was not enabled during the application build. Third, the attacker can create files/directories in the same directory where the executable is located. Fourth, the filesystem supports creation of files/directories that contain `?` in their name (i.e., non-Windows systems). Fifth, the attacker is able to determine the offset at which the PYZ archive is embedded in the executable. The attacker can create a directory (or a zip archive) next to the executable, with the name that matches the format used by PyInstaller's bootloader to transmit information about the location of PYZ archive to the bootstrap script. If this directory (or zip archive) contains a python module whose name matches the name used by the optional bytecode encryption feature, this module will be loaded and executed by the bootstrap script (in the absence of the real, built-in module that is available when the bytecode-encryption feature is enabled). This results in arbitrary code execution that requires no modification of the executable itself. If the executable is running with elevated privileges (for example, due to having the `setuid` bit set), the code in the injected module is also executed with the said elevated privileges, resulting in a local privilege escalation. PyInstaller 6.0.0 (f5adf291c8b832d5aff7632844f7e3ddf7ad4923) removed support for bytecode encryption; this effectively removes the described attack vector, due to the bootstrap script not attempting to load the optional module for bytecode-decryption anymore. PyInstaller 6.10.0 (cfd60b510f95f92cb81fc42735c399bb781a4739) reworked the bootstrap process to avoid (ab)using `sys.path` for transmitting location of the PYZ archive, which further eliminates the possibility of described injection procedure. If upgrading PyInstaller is not feasible, this issue can be worked around by ensuring proper permissions on directories containing security-sensitive executables (i.e., executables with `setuid` bit set) should mitigate the issue.

INFO

Published Date :

Sept. 9, 2025, 11:15 p.m.

Last Modified :

Oct. 23, 2026, 10:10 p.m.

Remotely Exploit :

No
Affected Products

The following products are affected by CVE-2025-59042 vulnerability. Even if cvefeed.io is aware of the exact versions of the products that are affected, the information is not represented in the table below.

ID Vendor Product Action
1 Pyinstaller pyinstaller
CVSS Scores
The Common Vulnerability Scoring System is a standardized framework for assessing the severity of vulnerabilities in software and systems. We collect and displays CVSS scores from various sources for each CVE.
Score Version Severity Vector Exploitability Score Impact Score Source
CVSS 134c704f-9b21-4f2e-91b3-4a467353bcc0
CVSS 4.0 HIGH [email protected]
Solution
Update PyInstaller to version 6.10.0 or later to fix the vulnerability.
  • Update PyInstaller to version 6.10.0.
  • Update PyInstaller to a version later than 6.10.0.
  • Ensure proper directory permissions for executables.
  • Rebuild applications with updated PyInstaller.
Public PoC/Exploit Available at Github

CVE-2025-59042 has a 1 public PoC/Exploit available at Github. Go to the Public Exploits tab to see the list.

References to Advisories, Solutions, and Tools

Here, you will find a curated list of external links that provide in-depth information, practical solutions, and valuable tools related to CVE-2025-59042.

URL Resource
https://github.com/pyinstaller/pyinstaller/commit/f5adf291c8b832d5aff7632844f7e3ddf7ad4923
https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-p2xp-xx3r-mffc
CWE - Common Weakness Enumeration

While CVE identifies specific instances of vulnerabilities, CWE categorizes the common flaws or weaknesses that can lead to vulnerabilities. CVE-2025-59042 is associated with the following CWEs:

Common Attack Pattern Enumeration and Classification (CAPEC)

Common Attack Pattern Enumeration and Classification (CAPEC) stores attack patterns, which are descriptions of the common attributes and approaches employed by adversaries to exploit the CVE-2025-59042 weaknesses.

We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).

AI-powered Python GUI for removing hard-coded subtitles and text watermarks from videos using STTN, LAMA, and ProPainter inpainting with GPU acceleration.

ai inpainting python subtitle-removal video

Batchfile Python NSIS PowerShell Dockerfile

Updated: 3 months, 1 week ago
38 stars 10 fork 10 watcher
Born at : Jan. 14, 2026, 2:17 a.m. This repo has been linked 3 different CVEs too.

Results are limited to the first 15 repositories due to potential performance issues.

The following list is the news that have been mention CVE-2025-59042 vulnerability anywhere in the article.

  • Daily CyberSecurity
PyInstaller Flaw : Are Your Python Apps Vulnerable to Hijacking?

The PyInstaller project has released fixes for a local privilege escalation vulnerability that affected applications packaged with versions prior to 6.0.0. Tracked as CVE-2025-59042 with a CVSS score ... Read more

Published Date: Sep 12, 2025 (1 year, 1 month ago)

The following table lists the changes that have been made to the CVE-2025-59042 vulnerability over time.

Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.

  • CVE Translated by [email protected]

    Oct. 23, 2026

    Action Type Old Value New Value
    Changed Translation Title: PyInstaller, Description: PyInstaller empaqueta una aplicación Python y todas sus dependencias en un único paquete. Debido a que se añade una entrada especial a 'sys.path' durante el proceso de arranque de una aplicación congelada con PyInstaller, y debido a que el script de arranque intenta cargar un módulo opcional para el descifrado de bytecode mientras esta entrada todavía está presente en 'sys.path', una aplicación construida con PyInstaller < 6.0.0 puede ser engañada por un atacante no privilegiado para la ejecución de código python arbitrario cuando se cumplen todas las siguientes condiciones. Primero, la aplicación está construida con PyInstaller < 6.0.0; tanto el modo onedir como el onefile están afectados. Segundo, la característica opcional de cifrado de código de bytecode no estaba habilitada durante la construcción de la aplicación. Tercero, el atacante puede crear archivos/directorios en el mismo directorio donde se encuentra el ejecutable. Cuarto, el sistema de archivos soporta la creación de archivos/directorios que contienen '?' en su nombre (es decir, sistemas que no son Windows). Quinto, el atacante es capaz de determinar el desplazamiento en el que el archivo PYZ está incrustado en el ejecutable. El atacante puede crear un directorio (o un archivo zip) junto al ejecutable, con el nombre que coincide con el formato utilizado por el cargador de arranque de PyInstaller para transmitir información sobre la ubicación del archivo PYZ al script de arranque. Si este directorio (o archivo zip) contiene un módulo python cuyo nombre coincide con el nombre utilizado por la característica opcional de cifrado de bytecode, este módulo será cargado y ejecutado por el script de arranque (en ausencia del módulo real, incorporado que está disponible cuando la característica de cifrado de bytecode está habilitada). Esto resulta en ejecución de código arbitrario que no requiere modificación del propio ejecutable. Si el ejecutable se está ejecutando con privilegios elevados (por ejemplo, debido a tener el bit 'setuid' establecido), el código en el módulo inyectado también se ejecuta con dichos privilegios elevados, resultando en una escalada de privilegios local. PyInstaller 6.0.0 (f5adf291c8b832d5aff7632844f7e3ddf7ad4923) eliminó el soporte para el cifrado de bytecode; esto elimina efectivamente el vector de ataque descrito, debido a que el script de arranque ya no intenta cargar el módulo opcional para el descifrado de bytecode. PyInstaller 6.10.0 (cfd60b510f95f92cb81fc42735c399bb781a4739) reelaboró el proceso de arranque para evitar (mal)usar 'sys.path' para transmitir la ubicación del archivo PYZ, lo que elimina aún más la posibilidad del procedimiento de inyección descrito. Si la actualización de PyInstaller no es factible, este problema puede solucionarse asegurando permisos adecuados en los directorios que contienen ejecutables sensibles a la seguridad (es decir, ejecutables con el bit 'setuid' establecido) debería mitigar el problema. Title: PyInstaller, Description: PyInstaller empaqueta una aplicación Python y todas sus dependencias en un único paquete. Debido a que se añade una entrada especial a 'sys.path' durante el proceso de arranque de una aplicación congelada con PyInstaller, y debido a que el script de arranque intenta cargar un módulo opcional para el descifrado de bytecode mientras esta entrada todavía está presente en 'sys.path', una aplicación construida con PyInstaller anterior a 6.0.0 puede ser engañada por un atacante no privilegiado para la ejecución de código python arbitrario cuando se cumplen todas las siguientes condiciones. Primero, la aplicación está construida con PyInstaller anterior a 6.0.0; tanto el modo onedir como el onefile están afectados. Segundo, la característica opcional de cifrado de código de bytecode no estaba habilitada durante la construcción de la aplicación. Tercero, el atacante puede crear archivos/directorios en el mismo directorio donde se encuentra el ejecutable. Cuarto, el sistema de archivos soporta la creación de archivos/directorios que contienen '?' en su nombre (es decir, sistemas que no son Windows). Quinto, el atacante es capaz de determinar el desplazamiento en el que el archivo PYZ está incrustado en el ejecutable. El atacante puede crear un directorio (o un archivo zip) junto al ejecutable, con el nombre que coincide con el formato utilizado por el cargador de arranque de PyInstaller para transmitir información sobre la ubicación del archivo PYZ al script de arranque. Si este directorio (o archivo zip) contiene un módulo python cuyo nombre coincide con el nombre utilizado por la característica opcional de cifrado de bytecode, este módulo será cargado y ejecutado por el script de arranque (en ausencia del módulo real, incorporado que está disponible cuando la característica de cifrado de bytecode está habilitada). Esto resulta en ejecución de código arbitrario que no requiere modificación del propio ejecutable. Si el ejecutable se está ejecutando con privilegios elevados (por ejemplo, debido a tener el bit 'setuid' establecido), el código en el módulo inyectado también se ejecuta con dichos privilegios elevados, resultando en una escalada de privilegios local. PyInstaller 6.0.0 (f5adf291c8b832d5aff7632844f7e3ddf7ad4923) eliminó el soporte para el cifrado de bytecode; esto elimina efectivamente el vector de ataque descrito, debido a que el script de arranque ya no intenta cargar el módulo opcional para el descifrado de bytecode. PyInstaller 6.10.0 (cfd60b510f95f92cb81fc42735c399bb781a4739) reelaboró el proceso de arranque para evitar (mal)usar 'sys.path' para transmitir la ubicación del archivo PYZ, lo que elimina aún más la posibilidad del procedimiento de inyección descrito. Si la actualización de PyInstaller no es factible, este problema puede solucionarse asegurando permisos adecuados en los directorios que contienen ejecutables sensibles a la seguridad (es decir, ejecutables con el bit 'setuid' establecido) debería mitigar el problema.
  • CVE Translated by [email protected]

    Oct. 19, 2026

    Action Type Old Value New Value
    Added Translation Title: PyInstaller, Description: PyInstaller empaqueta una aplicación Python y todas sus dependencias en un único paquete. Debido a que se añade una entrada especial a 'sys.path' durante el proceso de arranque de una aplicación congelada con PyInstaller, y debido a que el script de arranque intenta cargar un módulo opcional para el descifrado de bytecode mientras esta entrada todavía está presente en 'sys.path', una aplicación construida con PyInstaller < 6.0.0 puede ser engañada por un atacante no privilegiado para la ejecución de código python arbitrario cuando se cumplen todas las siguientes condiciones. Primero, la aplicación está construida con PyInstaller < 6.0.0; tanto el modo onedir como el onefile están afectados. Segundo, la característica opcional de cifrado de código de bytecode no estaba habilitada durante la construcción de la aplicación. Tercero, el atacante puede crear archivos/directorios en el mismo directorio donde se encuentra el ejecutable. Cuarto, el sistema de archivos soporta la creación de archivos/directorios que contienen '?' en su nombre (es decir, sistemas que no son Windows). Quinto, el atacante es capaz de determinar el desplazamiento en el que el archivo PYZ está incrustado en el ejecutable. El atacante puede crear un directorio (o un archivo zip) junto al ejecutable, con el nombre que coincide con el formato utilizado por el cargador de arranque de PyInstaller para transmitir información sobre la ubicación del archivo PYZ al script de arranque. Si este directorio (o archivo zip) contiene un módulo python cuyo nombre coincide con el nombre utilizado por la característica opcional de cifrado de bytecode, este módulo será cargado y ejecutado por el script de arranque (en ausencia del módulo real, incorporado que está disponible cuando la característica de cifrado de bytecode está habilitada). Esto resulta en ejecución de código arbitrario que no requiere modificación del propio ejecutable. Si el ejecutable se está ejecutando con privilegios elevados (por ejemplo, debido a tener el bit 'setuid' establecido), el código en el módulo inyectado también se ejecuta con dichos privilegios elevados, resultando en una escalada de privilegios local. PyInstaller 6.0.0 (f5adf291c8b832d5aff7632844f7e3ddf7ad4923) eliminó el soporte para el cifrado de bytecode; esto elimina efectivamente el vector de ataque descrito, debido a que el script de arranque ya no intenta cargar el módulo opcional para el descifrado de bytecode. PyInstaller 6.10.0 (cfd60b510f95f92cb81fc42735c399bb781a4739) reelaboró el proceso de arranque para evitar (mal)usar 'sys.path' para transmitir la ubicación del archivo PYZ, lo que elimina aún más la posibilidad del procedimiento de inyección descrito. Si la actualización de PyInstaller no es factible, este problema puede solucionarse asegurando permisos adecuados en los directorios que contienen ejecutables sensibles a la seguridad (es decir, ejecutables con el bit 'setuid' establecido) debería mitigar el problema.
  • CVE Modified by [email protected]

    Jun. 17, 2026

    Action Type Old Value New Value
    Added Affected [{'vendor': 'pyinstaller', 'product': 'pyinstaller', 'versions': [{'status': 'affected', 'version': '< 6.0.0'}]}]
  • CVE Modified by 134c704f-9b21-4f2e-91b3-4a467353bcc0

    Jun. 17, 2026

    Action Type Old Value New Value
    Added SSVC {'id': 'CVE-2025-59042', 'role': 'CISA Coordinator', 'options': [{'exploitation': 'none'}, {'automatable': 'no'}, {'technicalImpact': 'total'}], 'version': '2.0.3', 'timestamp': '2025-09-10T17:21:15.006896Z'}
  • New CVE Received by [email protected]

    Sep. 09, 2025

    Action Type Old Value New Value
    Added Description PyInstaller bundles a Python application and all its dependencies into a single package. Due to a special entry being appended to `sys.path` during the bootstrap process of a PyInstaller-frozen application, and due to the bootstrap script attempting to load an optional module for bytecode decryption while this entry is still present in `sys.path`, an application built with PyInstaller < 6.0.0 may be tricked by an unprivileged attacker into executing arbitrary python code when **all** of the following conditions are met. First, the application is built with PyInstaller < 6.0.0; both onedir and onefile mode are affected. Second, the optional bytecode encryption code feature was not enabled during the application build. Third, the attacker can create files/directories in the same directory where the executable is located. Fourth, the filesystem supports creation of files/directories that contain `?` in their name (i.e., non-Windows systems). Fifth, the attacker is able to determine the offset at which the PYZ archive is embedded in the executable. The attacker can create a directory (or a zip archive) next to the executable, with the name that matches the format used by PyInstaller's bootloader to transmit information about the location of PYZ archive to the bootstrap script. If this directory (or zip archive) contains a python module whose name matches the name used by the optional bytecode encryption feature, this module will be loaded and executed by the bootstrap script (in the absence of the real, built-in module that is available when the bytecode-encryption feature is enabled). This results in arbitrary code execution that requires no modification of the executable itself. If the executable is running with elevated privileges (for example, due to having the `setuid` bit set), the code in the injected module is also executed with the said elevated privileges, resulting in a local privilege escalation. PyInstaller 6.0.0 (f5adf291c8b832d5aff7632844f7e3ddf7ad4923) removed support for bytecode encryption; this effectively removes the described attack vector, due to the bootstrap script not attempting to load the optional module for bytecode-decryption anymore. PyInstaller 6.10.0 (cfd60b510f95f92cb81fc42735c399bb781a4739) reworked the bootstrap process to avoid (ab)using `sys.path` for transmitting location of the PYZ archive, which further eliminates the possibility of described injection procedure. If upgrading PyInstaller is not feasible, this issue can be worked around by ensuring proper permissions on directories containing security-sensitive executables (i.e., executables with `setuid` bit set) should mitigate the issue.
    Added CVSS V4.0 AV:L/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
    Added CWE CWE-94
    Added Reference https://github.com/pyinstaller/pyinstaller/commit/f5adf291c8b832d5aff7632844f7e3ddf7ad4923
    Added Reference https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-p2xp-xx3r-mffc
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days. Following chart shows the EPSS score history of the vulnerability.