cve.bz

CVE-2023-40590 gitpython project gitpython: Untrusted Search Path

7.8 highExploit referenceEPSS 0.5%Fix available

High (7.8) in gitpython project gitpython. EPSS 0.5% estimated probability of exploitation activity in the next 30 days. Fixed in gitpython 3.1.33.

On this page
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 user's `PATH`. This is more of a problem on how Python interacts with Windows systems, Linux and any other OS aren't 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 Files\\Git\\cmd\\git.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.

Severity

CVSS 3.1

7.8 high
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS
0.5% (unchanged from 0.5% a week ago; 0.5% 30 days ago) estimated probability of exploitation activity in the next 30 days; 44th percentile. Scored 2026-11-24. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: PoC · Automatable: no · Technical impact: total, assessed 2024-10-02. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-426 Untrusted Search Path
OWASP Top 10
A08:2025 Software or Data Integrity Failures
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2023-40590 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2023-40590?via=ask-ai-copy and https://cve.bz/cve/CVE-2023-40590?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2023-40590 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
gitpython_project:gitpythonthrough 3.1.32

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-wfm5-v35h-vwf4PyPIgitpython<3.1.333.1.33
PYSEC-2023-161PyPIgitpython<3.1.333.1.33

Linux distributions

DistributionReleasePackageFixed inAdvisory
Ubuntu22.04:LTS, Pro:14.04:LTS, Pro:16.04:LTS and 2 morepython-gitno fix listedUBUNTU-CVE-2023-40590
openSUSETumbleweedpython-GitPython3.1.56-1.1openSUSE-SU-2026:11419-1

From the distributions' data via OSV.dev: Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; SUSE security data, CC BY 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Ubuntu · openSUSE.

Red Hat

Red Hat rates this Important.

Red Hat's statement

This flaw only affects how python finds executables on windows , therefore, does not affect Linux.

ProductPackageStateAdvisory
Red Hat Ansible Automation Platform 2automation-controllerNot affected
Red Hat Ansible Automation Platform 2python3x-gitpythonNot affected
Red Hat Ansible Automation Platform 2python-gitdbNot affected
Red Hat Ansible Automation Platform 2python-gitpythonNot affected
Red Hat Ansible Automation Platform 2python-smmapNot affected
Red Hat Certification for Red Hat Enterprise Linux 7redhat-certificationNot affected
Red Hat Certification for Red Hat Enterprise Linux 8redhat-certificationNot affected
Red Hat Certification Program for Red Hat Enterprise Linux 9redhat-certificationNot affected
Red Hat OpenStack Platform 16.1GitPythonNot affected
Red Hat OpenStack Platform 16.1python-gitdbNot affected
Red Hat OpenStack Platform 16.1python-smmapNot affected
Red Hat OpenStack Platform 16.2GitPythonNot affected
Red Hat OpenStack Platform 16.2python-gitdbNot affected
Red Hat OpenStack Platform 16.2python-smmapNot affected
Red Hat OpenStack Platform 17.0GitPythonNot affected
Red Hat OpenStack Platform 17.0python-gitdbNot affected
Red Hat OpenStack Platform 17.0python-smmapNot affected
Red Hat OpenStack Platform 17.1GitPythonNot affected
Red Hat OpenStack Platform 17.1python-gitdbNot affected
Red Hat OpenStack Platform 17.1python-smmapNot affected
9 more in the JSON and on Red Hat's page.

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2023-40590.

Attack patterns (CAPEC)

  • CAPEC-38 Leveraging/Manipulating Configuration File Search Paths Likelihood: High · Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON