Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1qNGo5LTdoZzktOTdnNs4AAvPb
Poetry vulnerable to Untrusted Search Path leading to Local Code Execution on Windows
Observation
To handle dependencies that come from a Git repository, Poetry executes various commands, e.g. git config
. These commands are being executed using the executable’s name and not its absolute path.
This can lead to the execution of untrusted code due to the way Windows resolves executable names to paths. Unlike Linux-based operating systems, Windows searches for the executable in the current directory first and looks in the paths that are defined in the PATH
environment variable afterward. If the current directory contains unknown and thus potentially malicious files, the directory could contain an executable named git.exe
which would be executed by Poetry.
Poetry calls executables by name when handling dependencies from Git. Note that there might be even more places where Poetry calls executables by name.
Impact
This vulnerability can lead to Arbitrary Code Execution, which would lead to the takeover of the system. 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 checking that the referenced Git dependency is not malicious and points to a trusted Git repository.
The victim could also not protect themself by vetting any Git or Poetry config files that might be present in the directory, because the behavior is undocumented. This kind of attack vector has been used in the past to target security researchers by sending them projects to collaborate on, so we believe that there is a non-negligible risk.
Patches
1.1.9 || 1.2.0b1
Remediation
Upgrade to version 1.1.9 || 1.2.0b1
References
For more information
If you have any questions or comments about this advisory:
- Email us at [email protected]
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qNGo5LTdoZzktOTdnNs4AAvPb
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: over 1 year ago
Updated: about 1 year ago
CVSS Score: 7.3
CVSS vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
Identifiers: GHSA-j4j9-7hg9-97g6, CVE-2022-36070
References:
- https://github.com/python-poetry/poetry/security/advisories/GHSA-j4j9-7hg9-97g6
- https://nvd.nist.gov/vuln/detail/CVE-2022-36070
- https://github.com/python-poetry/poetry/releases/tag/1.1.9
- https://github.com/python-poetry/poetry/releases/tag/1.2.0b1
- https://github.com/advisories/GHSA-j4j9-7hg9-97g6
Blast Radius: 24.0
Affected Packages
pypi:poetry
Dependent packages: 225Dependent repositories: 1,968
Downloads: 35,267,877 last month
Affected Version Ranges: < 1.1.9
Fixed in: 1.1.9
All affected versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.5.0, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.7.0, 0.7.1, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5, 0.8.6, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.11.0, 0.11.1, 0.11.2, 0.11.3, 0.11.4, 0.11.5, 0.12.0, 0.12.1, 0.12.2, 0.12.3, 0.12.4, 0.12.5, 0.12.6, 0.12.7, 0.12.8, 0.12.9, 0.12.10, 0.12.11, 0.12.12, 0.12.13, 0.12.14, 0.12.15, 0.12.16, 0.12.17, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.0.10, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.1.7, 1.1.8
All unaffected versions: 1.1.9, 1.1.10, 1.1.11, 1.1.12, 1.1.13, 1.1.14, 1.1.15, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.8.2