CVE-2026-78679 in GitPython
Summary
by MITRE • 08/25/2026
GitPython before 3.1.59 contains an arbitrary file read vulnerability in TagReference.create() where a positional reference parameter bypasses the unsafe option guard. Attackers can supply a reference value like --file=<path> to read arbitrary files, with contents returned in the annotated tag message.
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 08/25/2026
The GitPython library, prior to version 3.1.59, contains a critical security flaw classified as an Arbitrary File Read vulnerability within its TagReference.create() method. This issue stems from insufficient input validation and improper handling of positional reference parameters passed by the caller. In typical usage scenarios for this function, developers provide a name or identifier for creating a new git tag. However, due to the way the underlying command-line arguments are constructed and processed, an attacker who can control the input provided to this method is able to inject malicious shell-like syntax that bypasses intended safety guards designed to prevent unsafe operations.
The core technical flaw lies in the failure of the library to properly sanitize or validate the reference parameter before passing it to the git command-line interface. Specifically, when a user supplies a value such as --file=<path>, this string is interpreted not merely as metadata but as an argument that alters the behavior of the underlying git process. This bypasses the unsafe option guard which is presumably intended to restrict operations to safe, standard tag creation procedures. By exploiting this misconfiguration, an attacker can trick the application into reading arbitrary files from the file system where the vulnerable code is executing.
The operational impact of this vulnerability allows for significant data exfiltration and potential further compromise of the host environment. Since the contents of the targeted file are returned within the annotated tag message, the retrieved data becomes directly accessible to the attacker through standard git operations or API responses that expose tag details. This can lead to the exposure of sensitive configuration files, source code secrets, private keys, or other proprietary information stored on the server. In environments where GitPython is used in web applications or automated build systems, this could result in a complete breach of confidentiality for critical assets hosted within the repository's working directory or related system paths.
From a classification perspective, this vulnerability aligns with CWE-200: Information Exposure and CWE-78: Improper Neutralization of Special Elements used in an OS Command (OS Command Injection), as it involves improper handling of user input leading to unintended file access via command-line argument manipulation. In the context of the MITRE ATT&CK framework, this behavior corresponds to T1530: Data from Local System and potentially T1059: Command and Scripting Interpreter if the read content is subsequently used for further exploitation steps such as credential harvesting or lateral movement preparation.
To mitigate this risk, organizations must immediately upgrade GitPython to version 3.1.59 or later, where these input validation checks have been strengthened to prevent the injection of malicious flags like --file=. Additionally, developers should implement strict allow-listing for any inputs passed to git command wrappers and avoid passing unsanitized user-controlled data directly into library functions that construct shell commands. Regular security audits of dependencies and continuous monitoring for new CVEs affecting widely used libraries are essential practices to maintain the integrity and confidentiality of software supply chains.