CVE-2022-36069 Poetry Argument Injection vulnerability can lead to local Code Execution
Attackers can achieve local code execution by injecting arguments via malicious Git repository URLs in Poetry.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2022-36069?
CVE-2022-36069 is a high-severity command injection vulnerability in python-poetry poetry, published on 7 Sep 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Official description
Poetry is a dependency manager for Python. When handling dependencies that come from a Git repository instead of a registry, Poetry uses various commands, such as `git clone`. These commands are constructed using user input (e.g. the repository URL). When building the commands, Poetry correctly avoids Command Injection vulnerabilities by passing an array of arguments instead of a command string. However, there is the possibility that a user input starts with a dash (`-`) and is therefore treated as an optional argument instead of a positional one. This can lead to Code Execution because some of the commands have options that can be leveraged to run arbitrary executables. If a developer is exploited, the attacker could steal credentials or persist their access. If the exploit happens on a server, the attackers could use their access to attack other internal systems. Since this vulnerability requires a fair amount of user interaction, it is not as dangerous as a remotely exploitable one. However, it still puts developers at risk when dealing with untrusted files in a way they think is safe, because the exploit still works when the victim tries to make sure nothing can happen, e.g. by vetting any Git or Poetry config files that might be present in the directory. Versions 1.1.9 and 1.2.0b1 contain patches for this issue.
Which versions are affected by CVE-2022-36069?
3 open source packages ship an affected version, including poetry. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
poetry PyPI | All versions | 1.1.9 |
poetry PyPI | All versions | 1.1.9 |
poetry PyPI | All versions | 1.1.9 |
Products include Python-Poetry Poetry.
How do I fix CVE-2022-36069?
Upgrade poetry to 1.1.9 or later.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2022-36069 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-36069 exists.
Other vulnerabilities in python-poetry poetry
Sources
Also known as AZL-10919, DEBIAN-CVE-2022-36069, GHSA-9xgj-fcgf-x6mw, PYSEC-2022-266, UBUNTU-CVE-2022-36069.