{"answers":{"affected":"3 open source packages ship an affected version, including pyinstaller.","exploited":"There is no known exploitation of CVE-2025-59042 in the wild and no public exploit code.","fix":"Upgrade pyinstaller to 6.0.0 or later.","what":"CVE-2025-59042 is a high-severity code injection vulnerability in pyinstaller, published on 9 Sep 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2025-59042 and fix it if it is affected.\n\nWhat it is: CVE-2025-59042 is a high-severity code injection vulnerability in pyinstaller, published on 9 Sep 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of CVE-2025-59042 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- pyinstaller (PyPI): affected all versions; fixed in 6.0.0\n- pyinstaller (PyPI): affected all versions; fixed in 6.0.0\n- pyinstaller (PyPI): affected all versions; fixed in 6.0.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2025-59042/ (Markdown: https://insights.sbomify.com/CVE-2025-59042/index.md)","id":"CVE-2025-59042","markdown":"https://insights.sbomify.com/CVE-2025-59042/index.md","name":"CVE-2025-59042","record":{"aliases":["GHSA-p2xp-xx3r-mffc","OESA-2025-2322","OESA-2025-2323","OESA-2025-2324","PYSEC-2026-1813"],"analysis":{"component_type":"developer_tool","fix_type":"upgrade","impacts":["code_execution","privilege_escalation"],"network_reachable":"adjacent_or_local","non_default_config":true,"product_category":"Python packaging tool","requires_auth":"low_privilege","summary":"An attacker can inject malicious Python code into PyInstaller-frozen applications via path manipulation, leading to arbitrary code execution and potential privilege escalation.","user_interaction":"required","vuln_class":"code_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[],"cvss":{"score":7,"severity":"high","source":"cna","vector":"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","version":"4.0"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"}],"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 \u003c 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 \u003c 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.","ecosystems":["PyPI"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"PyInstaller has local privilege escalation vulnerability","id":"CVE-2025-59042","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"code_injection","year":"2025"},"n_packages":3,"n_references":2,"next":{"headline":"OpenBao vulnerable to denial of service via malicious JSON request processing","id":"CVE-2025-59043"},"packages":[{"ecosystem":"PyPI","fixed":["6.0.0"],"introduced":["0"],"last_affected":[],"package":"pyinstaller","purl":null,"source":"GHSA-p2xp-xx3r-mffc"},{"ecosystem":"PyPI","fixed":["6.0.0"],"introduced":["0"],"last_affected":[],"package":"pyinstaller","purl":"pkg:pypi/pyinstaller","source":"GHSA-p2xp-xx3r-mffc"},{"ecosystem":"PyPI","fixed":["6.0.0"],"introduced":["0"],"last_affected":[],"package":"pyinstaller","purl":"pkg:pypi/pyinstaller","source":"PYSEC-2026-1813"}],"prev":{"headline":"Claude Code vulnerable to arbitrary code execution caused by maliciously configured git email","id":"CVE-2025-59041"},"products":["pyinstaller"],"published":"2025-09-09","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"PyPA Advisory Database","prefix":"PYSEC"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"total"},"state":"PUBLISHED","updated":"2025-09-10","vendors":["pyinstaller"]},"summary":"An attacker can inject malicious Python code into PyInstaller-frozen applications via path manipulation, leading to arbitrary code execution and potential privilege escalation.","url":"https://insights.sbomify.com/CVE-2025-59042/"}