Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2023-41040: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in gitpython-developers GitPython

0
Medium
VulnerabilityCVE-2023-41040cvecve-2023-41040cwe-22
Published: Wed Aug 30 2023 (08/30/2023, 21:07:42 UTC)
Source: CVE Database V5
Vendor/Project: gitpython-developers
Product: GitPython

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.

AI-Powered Analysis

AILast updated: 11/03/2025, 22:21:21 UTC

Technical Analysis

GitPython is a widely used Python library that facilitates interaction with Git repositories programmatically. The vulnerability CVE-2023-41040 is a path traversal flaw categorized under CWE-22, found in GitPython versions before 3.1.37. The root cause lies in the symbolic reference resolution code, specifically in the file git/refs/symbolic.py, where the library reads files from the .git directory based on user-supplied file names. The code concatenates the base .git directory path with the user-provided file name without verifying if the resulting path remains confined within the .git directory. This improper validation allows an attacker to craft a pathname that escapes the .git directory, causing GitPython to attempt to read arbitrary files on the filesystem. Although the vulnerability does not permit reading the contents of these files, it can lead to denial of service conditions by causing unexpected errors or crashes in applications relying on GitPython. The vulnerability requires local access (attack vector: local) but no privileges or user interaction, making it relatively easy to exploit in environments where untrusted input reaches GitPython. The issue was publicly disclosed on August 30, 2023, and has been remediated in GitPython version 3.1.37 by adding proper path validation to ensure file accesses remain within the .git directory. No known exploits are currently reported in the wild. The CVSS v3.1 base score is 4.0, reflecting a medium severity primarily due to the limited impact on confidentiality and integrity but a potential impact on availability.

Potential Impact

For European organizations, the primary impact of this vulnerability is the risk of denial of service in development environments, continuous integration/continuous deployment (CI/CD) pipelines, or any automated tooling that uses vulnerable GitPython versions. Disruptions could delay software development and deployment processes, impacting productivity and potentially delaying critical updates or patches. While the vulnerability does not expose sensitive data directly, the ability to cause service interruptions could be leveraged by attackers to degrade operational capabilities. Organizations relying heavily on automated Git operations or integrating GitPython into larger software supply chains may face increased risk. Additionally, if exploited in multi-tenant or shared environments, this vulnerability could be used to interfere with other users’ workflows. The impact is more pronounced in sectors with stringent uptime requirements such as finance, telecommunications, and critical infrastructure, which are prevalent in Europe.

Mitigation Recommendations

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.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2023-08-22T16:57:23.932Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 69092635fe7723195e0b61af

Added to database: 11/3/2025, 10:01:25 PM

Last enriched: 11/3/2025, 10:21:21 PM

Last updated: 11/6/2025, 2:08:03 PM

Views: 4

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats