CVE-2023-41040GitPython 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 be used to trigger a denial of service for the program. This issue has been addressed in version 3.1.37.
What to do
Fixed builds are available from Alpine, Debian, PyPI: see the table below for the fixed version per release.
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 25.10 | python-git | Not affected vulnerable_code_not_present | ||
| Ubuntu 22.04 | python-git | Fix pending | 3.1.24-1ubuntu0.1~esm3 (Ubuntu Pro) | UBUNTU-CVE-2023-41040 |
| Ubuntu 20.04 | python-git | Fix pending | 3.0.7-1ubuntu0.1~esm4 (Ubuntu Pro) | UBUNTU-CVE-2023-41040 |
| Ubuntu 18.04 | python-git | Fix pending | 2.1.8-1ubuntu0.1~esm4 (Ubuntu Pro) | UBUNTU-CVE-2023-41040 |
| Ubuntu 16.04 | python-git | Fix pending | 1.0.1+git137-gc8b8379-2.1ubuntu0.1~esm4 (Ubuntu Pro) | UBUNTU-CVE-2023-41040 |
| Ubuntu 14.04 | python-git | Fix pending | 0.3.2~RC1-3ubuntu0.1~esm3 (Ubuntu Pro) | UBUNTU-CVE-2023-41040 |
| Debian 14 | python-git | Fixed | 3.1.36-1 | DEBIAN-CVE-2023-41040 |
| Debian 13 | python-git | Fixed | 3.1.36-1 | DEBIAN-CVE-2023-41040 |
| Debian 12 | python-git | Fixed | 3.1.30-1+deb12u2 | DEBIAN-CVE-2023-41040 |
| Alpine Linux 3.24 | py3-gitpython | Fixed | 3.1.37-r0 | ALPINE-CVE-2023-41040 |
| Alpine Linux 3.23 | py3-gitpython | Fixed | 3.1.37-r0 | ALPINE-CVE-2023-41040 |
| Alpine Linux 3.22 | py3-gitpython | Fixed | 3.1.37-r0 | ALPINE-CVE-2023-41040 |
| Alpine Linux 3.21 | py3-gitpython | Fixed | 3.1.37-r0 | ALPINE-CVE-2023-41040 |
| Alpine Linux 3.20 | py3-gitpython | Fixed | 3.1.37-r0 | ALPINE-CVE-2023-41040 |
| Alpine Linux 3.19 | py3-gitpython | Fixed | 3.1.37-r0 | ALPINE-CVE-2023-41040 |
| PyPI library | gitpython | Fixed | 3.1.37 | PYSEC-2023-165 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- gitpython-developers GitPython: affected: < 3.1.37
References
- https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-cwvm-v4w8-q58c
- https://github.com/gitpython-developers/GitPython/pull/1672
- https://github.com/gitpython-developers/GitPython/commit/74e55ee4544867e1bd976b7df5a45869ee397b0b
- https://github.com/gitpython-developers/GitPython/commit/e98f57b81f792f0f5e18d33ee658ae395f9aa3c4
- 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
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.