CVE-2023-49797

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.
Configurations

Configuration 1 (hide)

cpe:2.3:a:pyinstaller:pyinstaller:*:*:*:*:*:*:*:*

History

19 Dec 2023, 04:15

Type Values Removed Values Added
References
  • () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2K2XIQLEMZIKUQUOWNDYWTEWYQTKMAN7/ -

19 Dec 2023, 03:15

Type Values Removed Values Added
References
  • () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ISRWT34FAF23PUOLVZ7RVWBZMWPDR5U7/ -

12 Dec 2023, 22:23

Type Values Removed Values Added
Summary
  • (es) 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.
CPE cpe:2.3:a:pyinstaller:pyinstaller:*:*:*:*:*:*:*:*
First Time Pyinstaller
Pyinstaller pyinstaller
References () https://github.com/pyinstaller/pyinstaller/pull/7827 - () https://github.com/pyinstaller/pyinstaller/pull/7827 - Issue Tracking, Patch
References () https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-9w2p-rh8c-v9g5 - () https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-9w2p-rh8c-v9g5 - Vendor Advisory
References () https://github.com/python/cpython/blob/0fb18b02c8ad56299d6a2910be0bab8ad601ef24/Lib/shutil.py#L623 - () https://github.com/python/cpython/blob/0fb18b02c8ad56299d6a2910be0bab8ad601ef24/Lib/shutil.py#L623 - Product
CVSS v2 : unknown
v3 : 8.8
v2 : unknown
v3 : 7.8

09 Dec 2023, 01:15

Type Values Removed Values Added
New CVE

Information

Published : 2023-12-09 01:15

Updated : 2023-12-19 04:15


NVD link : CVE-2023-49797

Mitre link : CVE-2023-49797

CVE.ORG link : CVE-2023-49797


JSON object : View

Products Affected

pyinstaller

  • pyinstaller
CWE
CWE-732

Incorrect Permission Assignment for Critical Resource

CWE-379

Creation of Temporary File in Directory with Insecure Permissions