SecurityContext

CVE-2023-49797: PyInstaller - Privilege Escalation

  • Cve: CVE-2023-49797
  • Name: PyInstaller - Privilege Escalation
  • 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.
  • Impact: Attackers can delete sensitive files with higher privileges, potentially leading to data loss or system compromise.
  • Remediation: Upgrade to PyInstaller version 5.13.1 or later (>= 5.13.1).
  • Vulnerability type: privilege_escalation
  • Vulnerability impact: file_system_write, privilege_escalation
  • Requirement type: admin_privileges
  • Requirements: Application runs as administrator, uses specific modules, and temporary directory is insecure
  • Labels source: projectdiscovery
  • Severity: high
  • Cvss score: 7.8
  • Cvss vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Epss score: 0.00324
  • Epss percentile: 0.25977
  • Assignee: [email protected]
  • Published at: 2023-12-09T01:15:07Z
  • Age in days: 1081
  • Modified at: 2026-06-17T06:36:29Z
  • Patch available: yes
  • References total: 5
  • Products total: 1
  • Oss: yes
  • Projects total: 1
  • Advisory url: https://nvd.nist.gov/vuln/detail/CVE-2023-49797
  • Nvd status: modified
  • Checked, none or zero: known exploited entries, nuclei templates, public exploits total, public exploits capped, public exploits, rejected by nvd
  • Not known: hackerone

Cwe

IdName
CWE-379Creation of Temporary File in Directory with Insecure Permissions
CWE-732Incorrect Permission Assignment for Critical Resource

References

Same in every row:

  • Source: nvd
UrlTags
https://github.com/pyinstaller/pyinstaller/pull/7827Issue Tracking, Patch
https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-9w2p-rh8c-v9g5Vendor Advisory
https://github.com/python/cpython/blob/0fb18b02c8ad56299d6a2910be0bab8ad601ef24/Lib/shutil.py#L623Product
https://lists.fedoraproject.org/archives/list/[email protected]/message/2K2XIQLEMZIKUQUOWNDYWTEWYQTKMAN7/
https://lists.fedoraproject.org/archives/list/[email protected]/message/ISRWT34FAF23PUOLVZ7RVWBZMWPDR5U7/

Products

ProductAffectedPlatform boundSourcesUrl
pyinstaller:pyinstaller< 5.13.1nonvd/v1/products/pyinstaller/pyinstaller

Projects

RepositoryLink kindsIndexedUrl
pyinstaller/pyinstallerpackage, pull, security_advisoryyes/v1/repositories/pyinstaller/pyinstaller

Index

  • Repositories: 61
  • Repositories high signal: 49
  • Packages: 1

Exploitation

  • Authentication required: yes
  • Checked, none or zero: known exploited, known exploited by, exploitation seen, public exploit, public exploit count, initial access, remote
  • Not known: known exploited since, vulncheck known exploited since, public exploit first date, nuclei template, initial access since, hackerone reports, exposed hosts