PyInstaller has local privilege escalation vulnerability
Key facts
- Attack vector
- Local
- Privileges required
- Low
- User interaction
- Passive
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA and GitHub. Impact type from CWE-94.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| pyinstaller | pyinstaller | before 6.0.0 | 6.0.0 | Patch available | CNA |
| — | pyinstaller (PyPI) | before 6.0.0 | 6.0.0 | Patch available | GHSA-p2xp-xx3r-mffc |
- pyinstaller Vendorpyinstaller Affected before 6.0.0 Fixed in 6.0.0 Patch available CNA
- pyinstaller (PyPI) Vendor— Affected before 6.0.0 Fixed in 6.0.0 Patch available GHSA-p2xp-xx3r-mffc
Remediation
- Fix · CNA pyinstaller (pyinstaller) Fixed in 6.0.0
- Fix · GHSA-p2xp-xx3r-mffc pyinstaller (PyPI) Fixed in 6.0.0 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2025-59042
- 2026-10-03 Alias added: GHSA-p2xp-xx3r-mffc
References
More pyinstaller vulnerabilities
- TI-2023-27204 Local Privilege Escalation in pyinstaller on Windows CVSS 3.1HIGH 8.8
- TI-2019-12563 Local Privilege Escalation present only on the Windows version of PyInstaller CVSS 3.1HIGH 7.8
Sources
- CVE-2025-59042 · CVE Program
- CVE-2025-59042 · NVD
- FIRST EPSS
- GHSA-p2xp-xx3r-mffc · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences