CVE-2023-41040
GitPython blind local file inclusion
Also known as GHSA-cwvm-v4w8-q58c, PYSEC-2023-165
Mitigation
- Upgrade gitpython to one of 3.1.37, 3.1.35 (or later in the same release line).
Who should check
- Projects that depend on PyPI package gitpython (< 3.1.37)
- Anyone running gitpython-developers GitPython < 3.1.37
Vulnerability facts
- Affected
- gitpython < 3.1.37
- Fixed in
- 3.1.37, 3.1.35
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 4.0 (v3.1, CNA)CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Local
- Attack complexity: Low
- Privileges required: None
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: None
- Integrity impact: None
- Availability impact: Low
- EPSS
- 1.05% chance of exploitation in 30 days (percentile 64, 2026-11-26)
- CWE
- CWE-22
- Modified
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 and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| PyPI gitpython | < 3.1.37 | 3.1.37, 3.1.35 | osv |
| gitpython-developers GitPython | < 3.1.37 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2023-41040. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2023-41040.md Affected: gitpython < 3.1.37 Fixed in: 3.1.37, 3.1.35 Steps: 1. Search this machine and project for gitpython (PyPI), gitpython-developers GitPython: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Patches
Other
- https://github.com/gitpython-developers/GitPython/blob/1c8310d7cae144f74a671cbe17e51f63a830adbf/git/refs/symbolic.py#L174-L175
- https://github.com/gitpython-developers/GitPython/releases/tag/3.1.37
- https://github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2023-165.yaml
- https://lists.debian.org/debian-lts-announce/2023/09/msg00036.html
- https://lists.debian.org/debian-lts-announce/2024/10/msg00030.html
- https://github.com/gitpython-developers/GitPython
FAQ
Is CVE-2023-41040 being exploited?
There is no confirmed exploitation: CVE-2023-41040 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.05% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2023-41040?
Medium: CVSS 4.0 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).
Which versions are affected by CVE-2023-41040?
gitpython < 3.1.37.
Is there a fix for CVE-2023-41040?
Yes. Fixed in 3.1.37, 3.1.35. Upgrade gitpython to one of 3.1.37, 3.1.35 (or later in the same release line).
How do I check if I'm affected by CVE-2023-41040?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.