/

CVE-2026-78675

Severity:

HIGH RISK

(8.4)

Path Injection (CWE-73) in GitPython Config Handling

CVE-2026-78675

Analyzed

Vulnerability type

Category:

External Control of File Name or Path

CWE:

CWE-73

Impact:

Local File Content Disclosure

Severity:

HIGH RISK

(8.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

GitPython before version 3.1.59 does not disable merge_includes while parsing .gitmodules files, allowing attacker-controlled include directives to reference arbitrary local paths. When submodule configuration is accessed, the resulting parsing error may disclose the first line of a targeted file through its exception message.

Affected context

The issue occurs in applications that use GitPython to inspect repositories containing attacker-controlled .gitmodules files. Risk is higher when a repository is cloned, imported, or otherwise processed from an untrusted source and the application accesses repo.submodules, allowing included paths to be interpreted before the configuration is safely constrained.

Exploit preconditions

  • Attack surface: GitPython repository and submodule configuration parsing
  • Required access: Ability to provide or modify a repository containing a malicious .gitmodules file
  • Trigger point: Access to the repository's submodule collection or equivalent configuration parsing path
  • Why exploitation is possible: Include directives are honored without adequately restricting referenced paths, and parser errors may incorporate content read from the targeted file

Why this happens

The vulnerability results from treating attacker-controlled .gitmodules include directives as trusted configuration. Because merge includes remain enabled during parsing, an external file path can influence which local file is read. If parsing then fails, the exception message may contain data from that file, mapping to CWE-73: External Control of File Name or Path and an information disclosure condition.

Potential impact

  • Sensitive local file content may be disclosed
  • Credentials, tokens, or configuration data could be exposed
  • Error logs or API responses may unintentionally propagate disclosed data
  • Applications processing untrusted repositories could suffer cross-tenant information leakage

General mitigation guidance

Mitigation generally focuses on preventing untrusted repository configuration from controlling local file access.

Common defensive patterns include:

  • Disable or reject include processing when parsing .gitmodules from untrusted repositories
  • Use an allowlist of permitted configuration sources and repository-relative paths
  • Resolve and validate paths before opening files, while preventing traversal outside approved directories
  • Avoid returning raw parser exceptions to untrusted users
  • Minimize process privileges and filesystem access for repository-processing services
  • Treat cloned or uploaded repository metadata as untrusted input by default

How teams detect issues like this

Organizations can detect this class of issue through:

  • Static analysis checks for configuration parsers that enable external includes
  • Code review searches for unrestricted path construction and file access driven by repository metadata
  • Tests using malicious .gitmodules files with external include targets and assertions that no local content appears in errors
  • Runtime monitoring for unexpected reads outside repository workspaces
  • Policy enforcement that blocks repository-processing components from accessing sensitive filesystem locations
  • Automated security review tools that flag externally controlled file paths and unsafe configuration handling

Sources

SourceLink
github.comgithub.com/gitpython-developers/GitPython/security/advisories/GHSA-7833-fr7j-v32q
vulncheck.comvulncheck.com/advisories/gitpython-before-local-file-content-disclosure-via-gitmodules

Frequently asked

questions

It can be reached remotely when an application processes attacker-supplied or untrusted repositories. The attacker generally does not need direct filesystem access if they can cause the vulnerable application to parse a crafted .gitmodules file.

The attacker needs a way to supply or influence repository metadata and trigger submodule configuration parsing. The targeted files must also be readable by the GitPython process.

Treat .gitmodules content as untrusted, disable or restrict include processing, constrain file access to approved repository paths, and avoid exposing raw parsing errors.

Apply strict path and configuration-source validation, run repository processing with least privilege, test hostile repository metadata, and monitor filesystem access for unexpected reads.

Find out what's already
exploitable in your codebase.