Arbitrary Code Injection Affecting pyinstaller package, versions [,6.0.0)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.01% (2nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Arbitrary Code Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-PYINSTALLER-12579198
  • published10 Sept 2025
  • disclosed9 Sept 2025
  • creditUnknown

Introduced: 9 Sep 2025

NewCVE-2025-59042  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

Upgrade pyinstaller to version 6.0.0 or higher.

Overview

pyinstaller is a package that bundles a Python application and all its dependencies into a single package

Affected versions of this package are vulnerable to Arbitrary Code Injection in the bootstrap process. An attacker can achieve arbitrary code execution by placing malicious files or directories in the same location as a vulnerable PyInstaller application. When the application starts, it can be tricked into loading and running the attacker's Python code due to how PyInstaller handles sys.path and attempts to load an optional bytecode decryption module. If the application runs with elevated privileges, this can lead to local privilege escalation. This exploit works in both "onedir" and "onefile" modes, but only if the optional bytecode encryption feature was not enabled during the application's build.

Notes: This is only exploitable if the filesystem supports creation of files/directories that contain '?' in their name (i.e., non-Windows systems) and the attacker is able to determine the offset at which the PYZ archive is embedded in the executable.

Workaround

This vulnerability can be mitigated by ensuring proper permissions on directories containing security-sensitive executables (for example, executables with the setuid bit set).

References

CVSS Base Scores

version 4.0
version 3.1