CVE-2023-41040

Public Exploit
GitPython blind local file inclusion

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.

Category

4.0
CVSS
Severity: Medium
CVSS 3.1 •
EPSS 0.22%
Vendor Advisory github.com
Affected: gitpython-developers GitPython
Published at:
Updated at:

References

Frequently Asked Questions

What is the severity of CVE-2023-41040?
CVE-2023-41040 has been scored as a medium severity vulnerability.
How to fix CVE-2023-41040?
To fix CVE-2023-41040, make sure you are using an up-to-date version of the affected component(s) by checking the vendor release notes. As for now, there are no other specific guidelines available.
Is CVE-2023-41040 being actively exploited in the wild?
It is possible that CVE-2023-41040 is being exploited or will be exploited in a near future based on public information. According to its EPSS score, there is a ~0% probability that this vulnerability will be exploited by malicious actors in the next 30 days.
What software or system is affected by CVE-2023-41040?
CVE-2023-41040 affects gitpython-developers GitPython.
This platform uses data from the NIST NVD, MITRE CVE, MITRE CWE, First.org and CISA KEV but is not endorsed or certified by these entities. CVE is a registred trademark of the MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. CWE is a registred trademark of the MITRE Corporation and the authoritative source of CWE content is MITRE's CWE web site.
© 2025 Under My Watch. All Rights Reserved.