CVE-2025-59042: Pyinstaller PyInstaller Has Local Privilege Escalation Vulnerability
HIGHCVE-2025-59042 is a HIGH pyinstaller has local privilege escalation vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Pyinstaller libraries in the PyPI ecosystem. The issue involves pyinstaller has local privilege escalation vulnerability. Remediation is available by upgrading affected packages to version 6.0.0.
CVE-2025-59042 at a Glance
How to Fix CVE-2025-59042
To remediate this vulnerability, upgrade all affected Pyinstaller dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install pyinstaller>=6.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show pyinstaller
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-59042, inspect your installed packages using pip:
pip show pyinstaller
Analyze the terminal output to locate any version of Pyinstaller in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.0.0), your application is affected.
Note: The pip show pyinstaller command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Pyinstaller, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-59042 Affected Pyinstaller Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pyinstaller
|
PyPI |
< 6.0.0
|
6.0.0
|
References
Frequently Asked Questions
What is CVE-2025-59042?
Which Pyinstaller versions are affected?
What version fixes CVE-2025-59042?
Is pyinstaller affected?
What CWE is associated with CVE-2025-59042?
How can I check PyPI dependencies for CVE-2025-59042?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-p2xp-xx3r-mffc",
"modified" : "2025-09-10T20:30:18Z",
"published" : "2025-09-10T20:30:18Z",
"aliases" : [ "CVE-2025-59042" ],
"summary" : "PyInstaller has local privilege escalation vulnerability",
"details" : "### Impact\n\nDue 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:\n\n1. Application is built with PyInstaller < 6.0.0; both onedir and onefile mode are affected.\n2. Optional bytecode encryption code feature was **not** enabled during the application build.\n3. The attacker can create files/directories in the same directory where the executable is located.\n4. The filesystem supports creation of files/directories that contain `?` in their name (i.e., non-Windows systems).\n5. The attacker is able to determine the offset at which the PYZ archive is embedded in the executable.\n\nThe 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.\n\nIf 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.\n\n### Patches\n\nPyInstaller 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.\n\nPyInstaller 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.\n\n### Workarounds\n\nIf upgrading PyInstaller is no 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.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pyinstaller"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "6.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-p2xp-xx3r-mffc"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-59042"
}, {
"type" : "WEB",
"url" : "https://github.com/pyinstaller/pyinstaller/commit/f5adf291c8b832d5aff7632844f7e3ddf7ad4923"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pyinstaller/pyinstaller"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-09-10T20:30:18Z",
"nvd_published_at" : "2025-09-09T23:15:37Z"
}
}