# CVE-2019-16784: Local Privilege Escalation present only on the Windows version of PyInstaller

> Local attackers can escalate privileges on Windows if PyInstaller onefile apps run as privileged users with world-writable temp directories.

- **Severity:** High 7.0 (`CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 14 Jan 2020
- **Updated:** 5 Aug 2024
- **Also known as:** GHSA-7fcj-pq9j-wh2r, PYSEC-2020-175

## What is CVE-2019-16784?

CVE-2019-16784 is a high-severity vulnerability in PyInstaller, published on 14 Jan 2020. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

In PyInstaller before version 3.6, only on Windows, a local privilege escalation vulnerability is present in this particular case: If a software using PyInstaller in "onefile" mode is launched by a privileged user (at least more than the current one) which have his "TempPath" resolving to a world writable directory. This is the case for example if the software is launched as a service or as a scheduled task using a system account (TempPath will be C:\Windows\Temp). In order to be exploitable the software has to be (re)started after the attacker launch the exploit program, so for a service launched at startup, a service restart is needed (e.g. after a crash or an upgrade).

Weakness: CWE-732 (Incorrect Permission Assignment for Critical Resource), CWE-250 (Execution with Unnecessary Privileges)

## Which versions are affected by CVE-2019-16784?

3 open source packages ship an affected version, including pyinstaller and PyInstaller. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `pyinstaller` | PyPI | All versions | 3.6 |
| `pyinstaller` | PyPI | All versions | 3.6 |
| `PyInstaller` | PyPI | All versions | 3.6 |

Products: Pyinstaller Pyinstaller.

## How do I fix CVE-2019-16784?

Upgrade pyinstaller to 3.6 or later.

## Is CVE-2019-16784 being exploited?

There is no known exploitation of CVE-2019-16784 in the wild and no public exploit code.

Public exploit code:

- Exploit for PyInstaller CVE-2019-16784 (github_poc): https://github.com/AlterSolutions/PyInstallerPrivEsc
- A Proof of Concept exploit for the PyInstaller CVE-2019-16783 (github_poc): https://github.com/Ckrielle/CVE-2019-16784-POC

## Other vulnerabilities in PyInstaller

- [CVE-2023-49797](https://insights.sbomify.com/CVE-2023-49797/): Local Privilege Escalation in pyinstaller on Windows (high 8.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2019-16784 and fix it if it is affected.

What it is: CVE-2019-16784 is a high-severity vulnerability in PyInstaller, published on 14 Jan 2020. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2019-16784 in the wild and no public exploit code.

Affected packages and fixed versions:
- pyinstaller (PyPI): affected all versions; fixed in 3.6
- pyinstaller (PyPI): affected all versions; fixed in 3.6
- PyInstaller (PyPI): affected all versions; fixed in 3.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2019-16784/ (Markdown: https://insights.sbomify.com/CVE-2019-16784/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2019-16784
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2019-16784
- OSV: https://osv.dev/vulnerability/CVE-2019-16784

---
From sbomify Insights: https://insights.sbomify.com/CVE-2019-16784/
Summaries are generated and may contain mistakes; the official description above is the record.
