# CVE-2023-49797: Local Privilege Escalation in pyinstaller on Windows

- Severity: High 8.8 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.32%, higher than 27% of CVEs (2026-12-01)
- Published: 2023-12-09T00:39:46.000Z
- Modified: 2026-06-17T06:36:29.110Z
- Also known as: GHSA-9w2p-rh8c-v9g5, PYSEC-2023-292
- Weaknesses: CWE-379, CWE-732
- Assigned by: GitHub_M

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

(As written by CVE List.)

## Affected

- pyinstaller pyinstaller: < 5.13.1; before 5.13.1
- pyinstaller (PyPI): before 5.13.1

## Every score

- GitHub_M: CVSS:3.1 8.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H`
- GitHub: CVSS:3.1 8.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- PyPA Advisory Database: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://github.com/pyinstaller/pyinstaller/security/advisories/GHSA-9w2p-rh8c-v9g5> (advisory, vendor-advisory, web)
- <https://github.com/pyinstaller/pyinstaller/pull/7827> (fix, issue-tracking, patch, web)
- <https://github.com/python/cpython/blob/0fb18b02c8ad56299d6a2910be0bab8ad601ef24/Lib/shutil.py#L623> (product, web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ISRWT34FAF23PUOLVZ7RVWBZMWPDR5U7/> (web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2K2XIQLEMZIKUQUOWNDYWTEWYQTKMAN7/> (web)
- <https://nvd.nist.gov/vuln/detail/CVE-2023-49797> (advisory)
- <https://github.com/pyinstaller/pyinstaller> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/pyinstaller/PYSEC-2023-292.yaml> (web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/2K2XIQLEMZIKUQUOWNDYWTEWYQTKMAN7> (web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ISRWT34FAF23PUOLVZ7RVWBZMWPDR5U7> (web)

## Sources

- CVE List: [CVE-2023-49797](https://www.cve.org/CVERecord?id=CVE-2023-49797), CVE Terms of Use, modified 2025-02-13
- GitHub Advisory Database: [GHSA-9w2p-rh8c-v9g5](https://github.com/advisories/GHSA-9w2p-rh8c-v9g5), CC-BY-4.0, modified 2024-11-22
- NVD: [CVE-2023-49797](https://nvd.nist.gov/vuln/detail/CVE-2023-49797), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2023-292](https://osv.dev/vulnerability/PYSEC-2023-292), CC-BY-4.0, modified 2024-11-21

---

Page: https://cve.day/CVE-2023-49797 · Whole record: https://cve.day/CVE-2023-49797.json · Rebuilt by cve.day 2026-11-25T22:58:31.173Z
