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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.8
- **CVSS:** 8.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Changed (impact reaches other components); Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.28% (percentile 13, 2026-11-26)
- **CWE:** CWE-379, CWE-732
- **Aliases:** GHSA-9w2p-rh8c-v9g5, PYSEC-2023-292
- **Published:** 2023-12-09T00:39:46.000Z
- **Modified:** 2026-06-17T06:36:29.110Z

## Who should check

- Projects that depend on PyPI package pyinstaller (\< 5.13.1)
- Anyone running pyinstaller \< 5.13.1

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

## Affected and fixed versions

- PyPI `pyinstaller`: affected \< 5.13.1; fixed 5.13.1 (osv)
- pyinstaller: \< 5.13.1 (cvelist)

## Mitigation

- Upgrade pyinstaller to 5.13.1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-49797. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-49797.md
Affected: pyinstaller < 5.13.1
Fixed in: 5.13.1

Steps:
1. Search this machine and project for pyinstaller (PyPI), pyinstaller: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-49797 being exploited?

There is no confirmed exploitation: CVE-2023-49797 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.28% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-49797?

High: CVSS 8.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2023-49797?

pyinstaller \< 5.13.1.

### Is there a fix for CVE-2023-49797?

Yes. Fixed in 5.13.1. Upgrade pyinstaller to 5.13.1 or later.

### How do I check if I'm affected by CVE-2023-49797?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

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

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-49797>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-9w2p-rh8c-v9g5> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/PYSEC-2023-292> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2023-49797> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-49797>
