cve.bz

CVE-2023-41040 gitpython project gitpython: Path traversal

6.5 mediumExploit referenceEPSS 1.1%Fix available

Medium (6.5) in gitpython project gitpython. EPSS 1.1% estimated probability of exploitation activity in the next 30 days. Fixed in gitpython 3.1.35, 3.1.37.

On this page
GitPython is a python library used to interact with Git repositories. In order to resolve some git references, GitPython reads files from the `.git` directory, in some places the name of the file being read is provided by the user, GitPython doesn't check if this file is located outside the `.git` directory. This allows an attacker to make GitPython read any file from the system. This vulnerability is present in https://github.com/gitpython-developers/GitPython/blob/1c8310d7cae144f74a671cbe17e51f63a830adbf/git/refs/symbolic.py#L174-L175. That code joins the base directory with a user given string without checking if the final path is located outside the base directory. This vulnerability cannot be used to read the contents of files but could in theory be used to trigger a denial of service for the program. This issue has been addressed in version 3.1.37.

Severity

CVSS 3.1

6.5 medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L
EPSS
1.1% (unchanged from 1.1% a week ago; 1.1% 30 days ago) estimated probability of exploitation activity in the next 30 days; 66th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: PoC · Automatable: no · Technical impact: partial, assessed 2024-10-01. 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-22 Improper Limitation of a Pathname to a Restricted Directory (Path traversal)
OWASP Top 10
A01:2025 Broken Access Control
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-41040 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2023-41040?via=ask-ai-copy and https://cve.bz/cve/CVE-2023-41040?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-41040 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.34

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-cwvm-v4w8-q58cPyPIgitpython<3.1.373.1.37
PYSEC-2023-165PyPIgitpython<3.1.353.1.35

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian10python-git2.1.11-1+deb10u2DLA-3589-1
Debian11python-git3.1.14-1+deb11u1DLA-3939-1
Debian12python-git3.1.30-1+deb12u2DEBIAN-CVE-2023-41040
Debian13, 14python-git3.1.36-1DEBIAN-CVE-2023-41040
UbuntuPro:14.04:LTSpython-git0.3.2~RC1-3ubuntu0.1~esm3UBUNTU-CVE-2023-41040 USN-8303-1
UbuntuPro:16.04:LTSpython-git1.0.1+git137-gc8b8379-2.1ubuntu0.1~esm4UBUNTU-CVE-2023-41040 USN-8303-1
UbuntuPro:18.04:LTSpython-git2.1.8-1ubuntu0.1~esm4UBUNTU-CVE-2023-41040 USN-8303-1
UbuntuPro:20.04:LTSpython-git3.0.7-1ubuntu0.1~esm4UBUNTU-CVE-2023-41040 USN-8303-1
UbuntuPro:22.04:LTSpython-git3.1.24-1ubuntu0.1~esm3UBUNTU-CVE-2023-41040 USN-8303-1
UbuntuPro:24.04:LTSpython-git3.1.37-3ubuntu0.1~esm2USN-8303-1
UbuntuPro:26.04:LTSpython-git3.1.46-1ubuntu0.1~esm1USN-8303-1
Red Hatansible_automation_platform:2.4::el8automation-controller-venv-tower0:4.5.5-2.el8apRHSA-2024:1640
Red Hatansible_automation_platform:2.4::el8python39-aiohttp, python3x-aiohttp, python39-aiohttp-debuginfo and 1 more0:3.9.3-1.el8apRHSA-2024:1640
Red Hatansible_automation_platform:2.4::el8python39-django, python3x-django0:4.2.11-1.el8apRHSA-2024:1640
Red Hatansible_automation_platform:2.4::el8python39-gitpython, python3x-gitpython0:3.1.40-1.el8apRHSA-2024:0322
Red Hatansible_automation_platform:2.4::el8python39-twisted, python3x-twisted, python39-twisted+tls0:23.10.0-1.el8apRHSA-2024:0322
Red Hatansible_automation_platform:2.4::el8, ansible_automation_platform_developer:2.4::el8, ansible_automation_platform_inside:2.4::el8receptor, receptorctl0:1.4.5-1.el8apRHSA-2024:1640
Red Hatansible_automation_platform:2.4::el9automation-controller-venv-tower0:4.5.5-2.el9apRHSA-2024:1640
Red Hatansible_automation_platform:2.4::el9python-aiohttp, python3-aiohttp, python3-aiohttp-debuginfo and 1 more0:3.9.3-1.el9apRHSA-2024:1640
Red Hatansible_automation_platform:2.4::el9python-django, python3-django0:4.2.11-1.el9apRHSA-2024:1640
Red Hatansible_automation_platform:2.4::el9python-gitpython, python3-gitpython0:3.1.40-1.el9apRHSA-2024:0322
Red Hatansible_automation_platform:2.4::el9python-twisted, python3-twisted, python3-twisted+tls0:23.10.0-1.el9apRHSA-2024:0322
Red Hatansible_automation_platform:2.4::el9, ansible_automation_platform_developer:2.4::el9, ansible_automation_platform_inside:2.4::el9receptor, receptorctl0:1.4.5-1.el9apRHSA-2024:1640
22 more for Red Hat in the JSON and on Red Hat's page.
SUSEPackage Hub 15 SP4python-GitPython3.1.12.1610074031.f653af66-bp154.2.3.1openSUSE-SU-2023:0271-1
SUSEPackage Hub 15 SP5python-GitPython3.1.12.1610074031.f653af66-bp155.3.3.1openSUSE-SU-2023:0259-1
openSUSELeap 15.4python-GitPython3.1.12.1610074031.f653af66-bp154.2.3.1openSUSE-SU-2023:0271-1
openSUSELeap 15.5python-GitPython3.1.12.1610074031.f653af66-bp155.3.3.1openSUSE-SU-2023:0259-1
openSUSETumbleweedpython-GitPython3.1.56-1.1openSUSE-SU-2026:11419-1
Alpinev3.19, v3.20, v3.21 and 3 morepy3-gitpython3.1.37-r0ALPINE-CVE-2023-41040

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

Red Hat

Red Hat rates this Moderate.

Red Hat's statement

This vulnerability cannot be used to read the contents of files but could be used to trigger a denial of service for the program.

ProductPackageStateAdvisory
Red Hat Ansible Automation Platform 2.4 for RHEL 8python3x-gitpython-0:3.1.40-1.el8apFixed 2024-01-22RHSA-2024:0322
Red Hat Ansible Automation Platform 2.4 for RHEL 8automation-controller-0:4.5.5-2.el8apFixed 2024-04-02RHSA-2024:1640
Red Hat Ansible Automation Platform 2.4 for RHEL 9python-gitpython-0:3.1.40-1.el9apFixed 2024-01-22RHSA-2024:0322
Red Hat Ansible Automation Platform 2.4 for RHEL 9automation-controller-0:4.5.5-2.el9apFixed 2024-04-02RHSA-2024:1640
Red Hat OpenStack Platform 17.1 for RHEL 8GitPython-0:3.1.14-2.el8ostFixed 2024-01-16RHSA-2024:0190
Red Hat OpenStack Platform 17.1 for RHEL 9GitPython-0:3.1.14-2.el9ostFixed 2024-01-16RHSA-2024:0215
Red Hat Satellite 6.14 for RHEL 8python-gitpython-0:3.1.40-0.1.el8pcFixed 2023-12-14RHSA-2023:7851
Red Hat Certification for Red Hat Enterprise Linux 7redhat-certificationOut of support scope
Red Hat Certification for Red Hat Enterprise Linux 8redhat-certificationWill not fix
Red Hat Certification Program for Red Hat Enterprise Linux 9redhat-certificationWill not fix
Red Hat OpenStack Platform 16.1GitPythonWill not fix
Red Hat OpenStack Platform 16.2GitPythonWill not fix

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-41040.

Attack patterns (CAPEC)

  • CAPEC-64 Using Slashes and URL Encoding Combined to Bypass Validation Logic Likelihood: High · Severity: High
  • CAPEC-76 Manipulating Web Input to File System Calls Likelihood: High · Severity: Very High
  • CAPEC-78 Using Escaped Slashes in Alternate Encoding Likelihood: High · Severity: High
  • CAPEC-79 Using Slashes in Alternate Encoding Likelihood: High · Severity: High
  • CAPEC-126 Path Traversal 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