Skip to content
OpenAdvisories
Medium · 4.0 CVE-2023-41040 EUVD-2023-0087GHSA-cwvm-v4w8-q58cPYSEC-2023-165

GitPython blind local file inclusion

Published Aug 30, 2023 · Updated Nov 3, 2025 · Assigned by GitHub_M

Description

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.

Affected products

VendorProductAffectedFixed
gitpython-developers GitPython < 3.1.37 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 python-git 3.1.36-1 —
Debian 13 python-git 3.1.36-1 —
Debian 12 python-git 3.1.30-1+deb12u2 —
Debian 11 python-git 3.1.14-1+deb11u1 DLA-3939-1
Debian 10 python-git 2.1.11-1+deb10u2 DLA-3589-1
ReleasePackageFixed inAdvisory
Ubuntu Pro 26.04 LTS python-git 3.1.46-1ubuntu0.1~esm1 USN-8303-1
Ubuntu Pro 24.04 LTS python-git 3.1.37-3ubuntu0.1~esm2 USN-8303-1
Ubuntu Pro 22.04 LTS python-git 3.1.24-1ubuntu0.1~esm3 USN-8303-1
Show 4 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 20.04 LTS python-git 3.0.7-1ubuntu0.1~esm4 USN-8303-1
Ubuntu Pro 18.04 LTS python-git 2.1.8-1ubuntu0.1~esm4 USN-8303-1
Ubuntu Pro 16.04 LTS python-git 1.0.1+git137-gc8b8379-2.1ubuntu0.1~esm4 USN-8303-1
Ubuntu Pro 14.04 LTS python-git 0.3.2~RC1-3ubuntu0.1~esm3 USN-8303-1
ReleasePackageFixed inAdvisory
Red Hat Satellite Utils 6 foreman +1 3.7.0.10-1.el8sat RHSA-2023:7851
Red Hat Satellite Utils 6 satellite +1 6.14.1-1.el8sat RHSA-2023:7851
Red Hat Satellite Capsule 6 createrepo_c +3 1.0.2-2.el8pc RHSA-2023:7851
Red Hat Satellite Capsule 6 foreman +1 3.7.0.10-1.el8sat RHSA-2023:7851
Red Hat Satellite Capsule 6 foreman-installer +1 1:3.7.0.5-1.el8sat RHSA-2023:7851
Red Hat Satellite Capsule 6 pulpcore-selinux 2.0.0-1.el8pc RHSA-2023:7851
Red Hat Satellite Capsule 6 python-django-import-export +1 3.1.0-1.el8pc RHSA-2023:7851
Red Hat Satellite Capsule 6 python-gitpython +1 3.1.40-0.1.el8pc RHSA-2023:7851
Red Hat Satellite Capsule 6 python-pulp-rpm +1 3.19.11-2.el8pc RHSA-2023:7851
Red Hat Satellite Capsule 6 python-pulpcore +1 3.22.19-1.el8pc RHSA-2023:7851
Red Hat Satellite Capsule 6 python-urllib3 +1 1.26.18-0.1.el8pc RHSA-2023:7851
Red Hat Satellite Capsule 6 rubygem-smart_proxy_remote_execution_ssh 0.10.2-2.el8sat RHSA-2023:7851
Red Hat Satellite Capsule 6 satellite +2 6.14.1-1.el8sat RHSA-2023:7851
Red Hat Satellite 6 createrepo_c +3 1.0.2-2.el8pc RHSA-2023:7851
Red Hat Satellite 6 foreman +13 3.7.0.10-1.el8sat RHSA-2023:7851
Red Hat Satellite 6 foreman-installer +1 1:3.7.0.5-1.el8sat RHSA-2023:7851
Red Hat Satellite 6 pulpcore-selinux 2.0.0-1.el8pc RHSA-2023:7851
Red Hat Satellite 6 python-django-import-export +1 3.1.0-1.el8pc RHSA-2023:7851
Red Hat Satellite 6 python-gitpython +1 3.1.40-0.1.el8pc RHSA-2023:7851
Red Hat Satellite 6 python-pulp-rpm +1 3.19.11-2.el8pc RHSA-2023:7851
Red Hat Satellite 6 python-pulpcore +1 3.22.19-1.el8pc RHSA-2023:7851
Red Hat Satellite 6 python-urllib3 +1 1.26.18-0.1.el8pc RHSA-2023:7851
Red Hat Satellite 6 rubygem-foreman_leapp 1.1.0-1.el8sat RHSA-2023:7851
Red Hat Satellite 6 rubygem-foreman_remote_execution +1 10.1.2-1.el8sat RHSA-2023:7851
Red Hat Satellite 6 rubygem-katello 4.9.0.18-1.el8sat RHSA-2023:7851
Red Hat Satellite 6 rubygem-rails +12 6.1.7.4-1.el8sat RHSA-2023:7851
Red Hat Satellite 6 rubygem-smart_proxy_remote_execution_ssh 0.10.2-2.el8sat RHSA-2023:7851
Red Hat Satellite 6 satellite +2 6.14.1-1.el8sat RHSA-2023:7851
Red Hat Satellite 6 satellite-convert2rhel-toolkit 1.0.0-1.el8sat RHSA-2023:7851
Show 4 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Red Hat OpenStack 17 GitPython +1 3.1.14-2.el8ost RHSA-2024:0215, RHSA-2024:0190
Red Hat Ansible Automation Platform Inside 2 receptor +1 1.4.5-1.el8ap RHSA-2024:1640
Red Hat Ansible Automation Platform Developer 2 receptor +1 1.4.5-1.el8ap RHSA-2024:1640
Red Hat Ansible Automation Platform 2 automation-controller-venv-tower 4.5.5-2.el8ap RHSA-2024:1640
Red Hat Ansible Automation Platform 2 python-aiohttp +1 3.9.3-1.el9ap RHSA-2024:1640
Red Hat Ansible Automation Platform 2 python-django +1 4.2.11-1.el9ap RHSA-2024:1640
Red Hat Ansible Automation Platform 2 python-gitpython +1 3.1.40-1.el9ap RHSA-2024:0322
Red Hat Ansible Automation Platform 2 python-twisted +2 23.10.0-1.el9ap RHSA-2024:0322
Red Hat Ansible Automation Platform 2 python39-aiohttp +1 3.9.3-1.el8ap RHSA-2024:1640
Red Hat Ansible Automation Platform 2 python39-django +1 4.2.11-1.el8ap RHSA-2024:1640
Red Hat Ansible Automation Platform 2 python39-gitpython +1 3.1.40-1.el8ap RHSA-2024:0322
Red Hat Ansible Automation Platform 2 python39-twisted +2 23.10.0-1.el8ap RHSA-2024:0322
Red Hat Ansible Automation Platform 2 receptor +1 1.4.5-1.el8ap RHSA-2024:1640
ReleasePackageFixed inAdvisory
SUSE Package Hub 15 SP5 python-GitPython 3.1.12.1610074031.f653af66-bp155.3.3.1 openSUSE-SU-2023:0259-1
SUSE Package Hub 15 SP4 python-GitPython 3.1.12.1610074031.f653af66-bp154.2.3.1 openSUSE-SU-2023:0271-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python-GitPython 3.1.56-1.1 openSUSE-SU-2026:11419-1
openSUSE Leap 15.5 python-GitPython 3.1.12.1610074031.f653af66-bp155.3.3.1 openSUSE-SU-2023:0259-1
openSUSE Leap 15.4 python-GitPython 3.1.12.1610074031.f653af66-bp154.2.3.1 openSUSE-SU-2023:0271-1
ReleasePackageFixed inAdvisory
Alpine v3.24 py3-gitpython 3.1.37-r0 —
Alpine v3.23 py3-gitpython 3.1.37-r0 —
Alpine v3.22 py3-gitpython 3.1.37-r0 —
Alpine v3.21 py3-gitpython 3.1.37-r0 —
Alpine v3.20 py3-gitpython 3.1.37-r0 —
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 py3-gitpython 3.1.37-r0 —

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI gitpython < 3.1.37 3.1.37 GHSA-cwvm-v4w8-q58c
PyPI gitpython < 3.1.35 3.1.35 PYSEC-2023-165

Advisories 12

References