CVE-2025-59042: PyInstaller Local Privilege Escalation Vulnerability
Summary
CVE-2025-59042: PyInstaller has local privilege escalation vulnerability. Affects pyinstaller versions < 6.0.0. Fixed in 6.0.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
PyInstaller is a popular tool used to convert Python applications into stand-alone executables, allowing developers to distribute their applications without requiring users to install Python or any dependencies. It supports both onefile and onedir modes for packaging applications. However, a vulnerability has been identified in versions prior to 6.0.0, which can lead to local privilege escalation under specific conditions.
Vulnerability Detail
The vulnerability arises from a special entry being appended to 'sys.path' during the bootstrap process of a PyInstaller-frozen application. If an application is built with PyInstaller versions less than 6.0.0 and does not enable the optional bytecode encryption feature, an attacker can exploit this by creating files or directories in the same location as the executable. The attacker must also be able to determine the offset of the PYZ archive within the executable. If successful, the attacker can execute arbitrary Python code, potentially leading to local privilege escalation if the executable runs with elevated privileges.
How To Fix
Minimum fixed version
6.0.0
This is the first release that contains the fix.
pip install --upgrade "pyinstaller==6.0.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading is not feasible, ensure proper permissions on directories containing security-sensitive executables, particularly those with the 'setuid' bit set. This can help mitigate the risk of exploitation.
Conclusion
The CVE-2025-59042 vulnerability in PyInstaller poses a significant risk of local privilege escalation for applications built with versions prior to 6.0.0. It is crucial for developers to update to the latest version or implement workarounds to secure their applications against potential exploitation.
See every vulnerability recorded for pyinstaller →
FAQ
CVE-2025-59042 is a vulnerability in PyInstaller that allows local privilege escalation due to improper handling of 'sys.path' during the bootstrap process.
Versions of PyInstaller prior to 6.0.0 are affected by this vulnerability.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check if your application is affected without requiring any signup.
If exploited, this vulnerability can allow an attacker to execute arbitrary Python code, potentially leading to local privilege escalation if the executable has elevated privileges.
If upgrading is not an option, ensure that proper permissions are set on directories containing sensitive executables to mitigate the risk of exploitation.
References
Related vulnerabilities
Recent vulnerabilities recorded for pyinstaller.