CVE-2023-41040: GitPython · Path Traversal
Affects GitPythonSource CVE Database V5
Not known to be exploited · CVSS 4.0 Medium : upgrade to 3.1.37 when convenient.
Data as of 26 Oct 2026, 06:26 UTC
- EPSS
- 1.0% chance of exploitation in 30 days – higher than 65% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
- Patch
- Available – fixed in 3.1.37
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LExploitation evidence
Disclosed: evidence found.
CVE published 30 Aug 2023
Detectable: no evidence on record.
No public nuclei template indexed
Weaponised: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 2026-10-26.
What to do
Upgrade GitPython to 3.1.37.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
PyPIgitpythonpkg:pypi/gitpythonOther threats | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
The most effective mitigation is to upgrade GitPython to version 3.1.37 or later, where the vulnerability has been fixed by enforcing proper path validation. Organizations should audit all codebases and CI/CD configurations to identify any usage of GitPython and ensure they are not running vulnerable versions. Where upgrading is not immediately possible, implementing strict input validation on any user-supplied data that influences GitPython operations can reduce risk. Running GitPython processes with least privilege and sandboxing them can limit the impact of potential exploitation. Monitoring logs for unusual errors related to file access in GitPython can help detect exploitation attempts. Additionally, educating developers about the risks of path traversal and secure handling of file paths in code is recommended to prevent similar issues.
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.
References
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-cwvm-v4w8-q58c (opens in a new tab)
- github.com/gitpython-developers/GitPython/pull/1672 (opens in a new tab)
- github.com/gitpython-developers/GitPython/commit/74e55ee4544867e1bd976b7df5a45869ee397b0b (opens in a new tab)
- github.com/gitpython-developers/GitPython/commit/e98f57b81f792f0f5e18d33ee658ae395f9aa3c4 (opens in a new tab)
- github.com/gitpython-developers/GitPython/blob/1c8310d7cae144f74a671cbe17e51f63a830adbf/git/refs/symbolic.py (opens in a new tab)
- github.com/gitpython-developers/GitPython/releases/tag/3.1.37 (opens in a new tab)
- github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2023-165.yaml (opens in a new tab)
- lists.debian.org/debian-lts-announce/2023/09/msg00036.html (opens in a new tab)
- lists.debian.org/debian-lts-announce/2024/10/msg00030.html (opens in a new tab)