CVE-2023-41040
published 2023-08-30CVE-2023-41040: 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…
PriorityP433medium6.5CVSS 3.1
AVNACLPRNUINSUCLINAL
EPSS
1.01%
58.8th percentile
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
6 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| debian | python-git | < python-git 3.1.30-1+deb12u2 (bookworm) | python-git 3.1.30-1+deb12u2 (bookworm) |
| gitpython-developers | gitpython | < 3.1.37 | 3.1.37 |
| gitpython_project | gitpython | <= 3.1.34 | — |
| gitpython_project | gitpython | >= 0 < 3.1.37 | 3.1.37 |
| gitpython_project | gitpython | >= 0 < 3.1.35 | 3.1.35 |
| ubuntu | python-git | — | — |
CVSS provenance
nvdv3.16.5MEDIUMCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L
osv6.5MEDIUM
vendor_ubuntu6.5MEDIUM
vendor_debian4.0MEDIUM
vendor_redhat4.0MEDIUM
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
GHSA
GitPython blind local file inclusion
ghsa·2023-08-30
CVE-2023-41040 [MEDIUM] CWE-22 GitPython blind local file inclusion
GitPython blind local file inclusion
### Summary
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.
### Details
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.
I was able to exploit it from three places, but there may be more code paths that lead to it:
https://github.com/gitpython-d
OSV
GitPython blind local file inclusion
osv·2023-08-30
CVE-2023-41040 [MEDIUM] GitPython blind local file inclusion
GitPython blind local file inclusion
### Summary
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.
### Details
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.
I was able to exploit it from three places, but there may be more code paths that lead to it:
https://github.com/gitpython-d
OSV
CVE-2023-41040: GitPython is a python library used to interact with Git repositories
osv·2023-08-30
CVE-2023-41040 CVE-2023-41040: GitPython is a python library used to interact with Git repositories
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
OSV
CVE-2023-41040: GitPython is a python library used to interact with Git repositories
osv·2023-08-30·CVSS 6.5
CVE-2023-41040 [MEDIUM] CVE-2023-41040: GitPython is a python library used to interact with Git repositories
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
Ubuntu
GitPython vulnerabilities
vendor_ubuntu·2026-05-26·CVSS 6.5
CVE-2026-42215 [MEDIUM] GitPython vulnerabilities
Title: GitPython vulnerabilities
Summary: Several security issues were fixed in GitPython.
Santos Gallegos discovered that GitPython did not properly validate
paths when resolving certain Git references. An attacker could possibly
use this issue to cause files outside the .git directory to be accessed,
leading to a denial of service. This issue only affected Ubuntu 14.04
LTS, Ubuntu 16.04 LTS, Ubuntu 18.04 LTS, Ubuntu 20.04 LTS, and Ubuntu
22.04 LTS. (CVE-2023-41040)
Wes Ring discovered that GitPython did not properly block certain unsafe
Git options when they were provided as Python keyword arguments. An
attacker could possibly use this issue to cause arbitrary command
execution. (CVE-2026-42215)
It was discovered that GitPython did not properly validate clone options
before processin
Red Hat
GitPython: Blind local file inclusion
vendor_redhat·2023-08-31·CVSS 4.0
CVE-2023-41040 [MEDIUM] CWE-22 GitPython: Blind local file inclusion
GitPython: Blind local file inclusion
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
Debian
CVE-2023-41040: python-git - GitPython is a python library used to interact with Git repositories. In order t...
vendor_debian·2023·CVSS 4.0
CVE-2023-41040 [MEDIUM] CVE-2023-41040: python-git - GitPython is a python library used to interact with Git repositories. In order t...
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
No detection rules found.
No public exploits indexed.
https://github.com/gitpython-developers/GitPython/blob/1c8310d7cae144f74a671cbe17e51f63a830adbf/git/refs/symbolic.py#L174-L175https://github.com/gitpython-developers/GitPython/commit/74e55ee4544867e1bd976b7df5a45869ee397b0bhttps://github.com/gitpython-developers/GitPython/commit/e98f57b81f792f0f5e18d33ee658ae395f9aa3c4https://github.com/gitpython-developers/GitPython/pull/1672https://github.com/gitpython-developers/GitPython/releases/tag/3.1.37https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-cwvm-v4w8-q58chttps://github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2023-165.yamlhttps://lists.debian.org/debian-lts-announce/2023/09/msg00036.htmlhttps://github.com/gitpython-developers/GitPython/blob/1c8310d7cae144f74a671cbe17e51f63a830adbf/git/refs/symbolic.py#L174-L175https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-cwvm-v4w8-q58chttps://lists.debian.org/debian-lts-announce/2023/09/msg00036.htmlhttps://lists.debian.org/debian-lts-announce/2024/10/msg00030.html
2023-08-30
Published