# CVE-2025-59042: PyInstaller has local privilege escalation vulnerability

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.0
- **CVSS:** 7.0 (v4.0, CNA) `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`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Attack requirements: None; Privileges required: Low; User interaction: Passive; Confidentiality impact: High; Integrity impact: High; Availability impact: High; Confidentiality impact on other systems: None; Integrity impact on other systems: None; Availability impact on other systems: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.16% (percentile 3, 2026-11-26)
- **CWE:** CWE-94
- **Aliases:** GHSA-p2xp-xx3r-mffc, PYSEC-2026-1813
- **Published:** 2025-09-09T22:28:20.394Z
- **Modified:** 2026-10-23T22:10:00.160Z

## Who should check

- Projects that depend on PyPI package pyinstaller (\< 6.0.0)
- Anyone running pyinstaller \< 6.0.0

## 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.

## Affected and fixed versions

- PyPI `pyinstaller`: affected \< 6.0.0; fixed 6.0.0 (osv)
- pyinstaller: \< 6.0.0 (cvelist)

## Mitigation

- Upgrade pyinstaller to 6.0.0 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-59042. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-59042.md
Affected: pyinstaller < 6.0.0
Fixed in: 6.0.0

Steps:
1. Search this machine and project for pyinstaller (PyPI), pyinstaller: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-59042 being exploited?

There is no confirmed exploitation: CVE-2025-59042 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.16% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-59042?

High: CVSS 7.0 (v4.0, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work.

### Which versions are affected by CVE-2025-59042?

pyinstaller \< 6.0.0.

### Is there a fix for CVE-2025-59042?

Yes. Fixed in 6.0.0. Upgrade pyinstaller to 6.0.0 or later.

### How do I check if I'm affected by CVE-2025-59042?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-p2xp-xx3r-mffc>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2025-59042>
- vendor: <https://github.com/advisories/GHSA-p2xp-xx3r-mffc>
- patch: <https://github.com/pyinstaller/pyinstaller/commit/f5adf291c8b832d5aff7632844f7e3ddf7ad4923>
- other: <https://github.com/pyinstaller/pyinstaller>
- other: <https://pypi.org/project/pyinstaller>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-59042>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-p2xp-xx3r-mffc> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/PYSEC-2026-1813> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2025-59042> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-59042>
