8.8
HIGH
CVE-2023-49797
PyInstaller Privilege Escalation Directory Traversal
Description

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.

INFO

Published Date :

Dec. 9, 2023, 1:15 a.m.

Last Modified :

Dec. 19, 2023, 4:15 a.m.

Remotely Exploitable :

No

Impact Score :

6.0

Exploitability Score :

2.0
Affected Products

The following products are affected by CVE-2023-49797 vulnerability. Even if cvefeed.io is aware of the exact versions of the products that are affected, the information is not represented in the table below.

ID Vendor Product Action
1 Pyinstaller pyinstaller

We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).

Results are limited to the first 15 repositories due to potential performance issues.

The following list is the news that have been mention CVE-2023-49797 vulnerability anywhere in the article.

The following table lists the changes that have been made to the CVE-2023-49797 vulnerability over time.

Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.

  • CVE Modified by [email protected]

    May. 14, 2024

    Action Type Old Value New Value
  • CVE Modified by [email protected]

    Dec. 19, 2023

    Action Type Old Value New Value
    Added Reference GitHub, Inc. https://lists.fedoraproject.org/archives/list/[email protected]/message/2K2XIQLEMZIKUQUOWNDYWTEWYQTKMAN7/ [No types assigned]
  • CVE Modified by [email protected]

    Dec. 19, 2023

    Action Type Old Value New Value
    Added Reference GitHub, Inc. https://lists.fedoraproject.org/archives/list/[email protected]/message/ISRWT34FAF23PUOLVZ7RVWBZMWPDR5U7/ [No types assigned]
  • Initial Analysis by [email protected]

    Dec. 12, 2023

    Action Type Old Value New Value
    Added CVSS V3.1 NIST AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
    Changed Reference Type https://github.com/pyinstaller/pyinstaller/pull/7827 No Types Assigned https://github.com/pyinstaller/pyinstaller/pull/7827 Issue Tracking, Patch
    Changed Reference Type https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-9w2p-rh8c-v9g5 No Types Assigned https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-9w2p-rh8c-v9g5 Vendor Advisory
    Changed Reference Type https://github.com/python/cpython/blob/0fb18b02c8ad56299d6a2910be0bab8ad601ef24/Lib/shutil.py#L623 No Types Assigned https://github.com/python/cpython/blob/0fb18b02c8ad56299d6a2910be0bab8ad601ef24/Lib/shutil.py#L623 Product
    Added CWE NIST CWE-732
    Added CPE Configuration OR *cpe:2.3:a:pyinstaller:pyinstaller:*:*:*:*:*:*:*:* versions up to (excluding) 5.13.1
  • CVE Received by [email protected]

    Dec. 09, 2023

    Action Type Old Value New Value
    Added Description 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.
    Added Reference GitHub, Inc. https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-9w2p-rh8c-v9g5 [No types assigned]
    Added Reference GitHub, Inc. https://github.com/pyinstaller/pyinstaller/pull/7827 [No types assigned]
    Added Reference GitHub, Inc. https://github.com/python/cpython/blob/0fb18b02c8ad56299d6a2910be0bab8ad601ef24/Lib/shutil.py#L623 [No types assigned]
    Added CWE GitHub, Inc. CWE-379
    Added CWE GitHub, Inc. CWE-732
    Added CVSS V3.1 GitHub, Inc. AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days. Following chart shows the EPSS score history of the vulnerability.
Exploit Prediction

EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days.

0.04 }} -0.00%

score

0.05768

percentile

CVSS31 - Vulnerability Scoring System
Attack Vector
Attack Complexity
Privileges Required
User Interaction
Scope
Confidentiality
Integrity
Availability