// For flags

CVE-2023-49797

Local Privilege Escalation in pyinstaller on Windows

Severity Score

7.8
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

0
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

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.

PyInstaller agrupa una aplicación Python y todas sus dependencias en un solo paquete. Una aplicación creada por PyInstaller, elevada como proceso privilegiado, puede ser engañada por un atacante sin privilegios para que elimine archivos a los que el usuario sin privilegios no tendría acceso de otro modo. Un usuario se ve afectado si se cumplen **todos** los siguientes requisitos: 1. El usuario ejecuta una aplicación que contiene `matplotlib` o `win32com`. 2. La aplicación se ejecuta como administrador (o al menos como usuario con mayores privilegios que el atacante). 3. El directorio temporal del usuario no está bloqueado para ese usuario específico (muy probablemente debido a que las variables de entorno `TMP`/`TEMP` apuntan a una ubicación desprotegida, arbitraria y no predeterminada). Ya sea: A. El atacante puede programar con mucho cuidado el reemplazo de un archivo temporal con un enlace simbólico. Este cambio debe ocurrir exactamente entre la verificación de enlace simbólico incorporada de `shutil.rmtree()` y la eliminación misma. B: La aplicación fue creada con Python 3.7.x o anterior, que no tiene protección contra enlaces de Directory Junctions. La vulnerabilidad se abordó en el PR #7827 que corresponde a `pyinstaller >= 5.13.1`. Se recomienda a los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad.

*Credits: N/A
CVSS Scores
Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2023-11-30 CVE Reserved
  • 2023-12-09 CVE Published
  • 2023-12-13 EPSS Updated
  • 2024-08-02 CVE Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
  • ---------- First Exploit
CWE
  • CWE-379: Creation of Temporary File in Directory with Insecure Permissions
  • CWE-732: Incorrect Permission Assignment for Critical Resource
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Pyinstaller
Search vendor "Pyinstaller"
Pyinstaller
Search vendor "Pyinstaller" for product "Pyinstaller"
< 5.13.1
Search vendor "Pyinstaller" for product "Pyinstaller" and version " < 5.13.1"
-
Affected