CVE Vulnerabilities

CVE-2023-40590

Untrusted Search Path

Published: Aug 28, 2023 | Modified: Sep 05, 2023
CVSS 3.x
7.8
HIGH
Source:
NVD
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CVSS 2.x
RedHat/V2
RedHat/V3
7.8 IMPORTANT
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Ubuntu
NEGLIGIBLE

GitPython is a python library used to interact with Git repositories. When resolving a program, Python/Windows look for the current working directory, and after that the PATH environment. GitPython defaults to use the git command, if a user runs GitPython from a repo has a git.exe or git executable, that program will be run instead of the one in the users PATH. This is more of a problem on how Python interacts with Windows systems, Linux and any other OS arent affected by this. But probably people using GitPython usually run it from the CWD of a repo. An attacker can trick a user to download a repository with a malicious git executable, if the user runs/imports GitPython from that directory, it allows the attacker to run any arbitrary commands. There is no fix currently available for windows users, however there are a few mitigations. 1: Default to an absolute path for the git program on Windows, like C:Program FilesGitcmdgit.EXE (default git path installation). 2: Require users to set the GIT_PYTHON_GIT_EXECUTABLE environment variable on Windows systems. 3: Make this problem prominent in the documentation and advise users to never run GitPython from an untrusted repo, or set the GIT_PYTHON_GIT_EXECUTABLE env var to an absolute path. 4: Resolve the executable manually by only looking into the PATH environment variable.

Weakness

The product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product’s direct control.

Affected Software

Name Vendor Start Version End Version
Gitpython Gitpython_project * 3.1.32 (including)
Python-git Ubuntu bionic *
Python-git Ubuntu devel *
Python-git Ubuntu esm-apps/bionic *
Python-git Ubuntu esm-apps/focal *
Python-git Ubuntu esm-apps/jammy *
Python-git Ubuntu esm-apps/xenial *
Python-git Ubuntu esm-infra-legacy/trusty *
Python-git Ubuntu focal *
Python-git Ubuntu jammy *
Python-git Ubuntu lunar *
Python-git Ubuntu trusty *
Python-git Ubuntu trusty/esm *
Python-git Ubuntu xenial *

Extended Description

This might allow attackers to execute their own programs, access unauthorized data files, or modify configuration in unexpected ways. If the product uses a search path to locate critical resources such as programs, then an attacker could modify that search path to point to a malicious program, which the targeted product would then execute. The problem extends to any type of critical resource that the product trusts. Some of the most common variants of untrusted search path are:

Potential Mitigations

References