CVE-2023-49797: Local Privilege Escalation in Windows

CVE-2023-49797 · Severity: low · CVSS 3.1 · Published 2023-12-09

PyInstaller bundles a Python application and all its dependencies into a single package. A PyInstaller built application, elevated as a privileged process, may be tricked by an unprivileged attacker into deleting files the unprivileged user does not otherwise have access to. A user is affected if **all** the following are satisfied: 1. The user runs an application containing either `matplotlib` or `win32com`. 2. The application is ran as administrator (or at least a user with higher privileges than the attacker). 3. The user's temporary directory is not locked to that specific user (most likely due to `TMP`/`TEMP` environment variables pointing to an unprotected, arbitrary, non default location). Either: A. The attacker is able to very carefully time the replacement of a temporary file with a symlink. This switch must occur exactly between `shutil.rmtree()`'s builtin symlink check and the deletion itself B: The application was built with Python 3.7.x or earlier which has no protection against Directory Junctions links. The vulnerability has been addressed in PR #7827 which corresponds to `pyinstaller >= 5.13.1`. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Technologies: pyinstaller (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2023-49797 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2023-49797 being exploited in the wild.
How severe is CVE-2023-49797?
Low severity, with a CVSS score of 3.1, published 9 December 2023.
Which products and versions are affected?
pyinstaller (PyPI) ECOSYSTEM:introduced=0,fixed=5.13.1.
Is there a fix for CVE-2023-49797?
Yes. pyinstaller (PyPI): upgrade to 5.13.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
Am I affected by CVE-2023-49797?
Check whether you run pyinstaller (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • pyinstaller (PyPI): upgrade to 5.13.1 or later
    pip install "pyinstaller>=5.13.1"

Affected products

  • pyinstaller (PyPI) ECOSYSTEM:introduced=0,fixed=5.13.1

Identifiers

  • CVE-2023-49797
  • GHSA-9w2p-rh8c-v9g5
  • PYSEC-2023-292

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.