1. Archivio CVE
  2. 2022
  3. CVE-2022-36070

CVE-2022-36070

7.3 Gravità alta CVSS v3.1 · fonte NVD CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H 7.3 – Alta

Descrizione

Poetry is a dependency manager for Python. 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. 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. 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. Versions 1.1.9 and 1.2.0b1 contain patches for this issue.

Prodotti coinvolti

FornitoreProdottoVersionePiattaforma
python-poetry poetry < 1.1.9 python
python-poetry poetry 1.2.0 alpha1 python
python-poetry poetry 1.2.0 alpha2 python

Tipo di vulnerabilità

CWE-426 Percorso di ricerca non attendibile

Il prodotto cerca risorse critiche usando un percorso di ricerca fornito dall’esterno, che può puntare a risorse fuori dal suo controllo diretto.

Impatto sui sistemi

AmbitoImpatto
Integrità, Riservatezza, Disponibilità, Controllo degli accessi Ottenere privilegi o assumere un’altra identità, Eseguire codice o comandi non autorizzati
Disponibilità Interruzione del servizio: arresto o riavvio
Riservatezza Leggere file o cartelle
Altro Dipende dal contesto

Come si previene

Architettura e progettazione · Sviluppo · Riduzione della superficie di attacco Hard-code the search path to a set of known-safe values (such as system directories), or only allow them to be specified by the administrator in a configuration file. Do not allow these settings to be modified by an external party. Be careful to avoid related weaknesses such as CWE-426 and CWE-428.
Sviluppo When invoking other programs, specify those programs using fully-qualified pathnames. While this is an effective approach, code that uses fully-qualified pathnames might not be portable to other systems that do not use the same pathnames. The portability can be improved by locating the full-qualified paths in a centralized, easily-modifiable location within the source code, and having the code refer to these paths.
Sviluppo Remove or restrict all environment settings before invoking other programs. This includes the PATH environment variable, LD_LIBRARY_PATH, and other settings that identify the location of code libraries, and any application-specific search paths.
Sviluppo Check your search path before use and remove any elements that are likely to be unsafe, such as the current working directory or a temporary files directory.
Sviluppo Use other functions that require explicit paths. Making use of any of the other readily available functions that require explicit paths is a safe way to avoid this problem. For example, system() in C does not require a full path since the shell can take care of it, while execl() and execv() require a full path.

Le indicazioni di mitigazione sono riportate nella lingua originale del catalogo CWE del MITRE.

Tutte le 702 CVE di tipo CWE-426, con andamento e prevenzione

Fonte: catalogo CWE del MITRE · cwe.mitre.org