Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/go-git/go-git/v5
  4. ›
  5. CVE-2026-45571

CVE-2026-45571: go-git: Crafted repositories may modify main and submodule .git directories

May 19, 2026

A path validation issue in go-git could allow crafted repository data to affect files outside the intended checkout target, including the repository’s .git directory.

These validations were introduced in upstream Git years ago, so the vulnerability arose from go-git drifting from those checks. Some attack vectors were platform-specific: certain payloads affected only Windows users, others affected only macOS users, and some applied across all supported platforms.

Using non-descendant go-billy filesystem instances, or different filesystem types, for the Storer and Worktree may provide some isolation against .git directory manipulation. For example, users that store the .git directory through memfs while using osfs for the worktree are not affected by this vulnerability in the main repository, because repository metadata is not materialized inside the worktree filesystem.

However, this isolation does not necessarily apply when the repository contains submodules, since submodule dotgit directories may still be represented or materialized within the worktree context.

It is important to note that exploitation requires a maliciously crafted repository payload. Users should always exercise caution when interacting with repositories or Git servers they do not trust.

References

  • github.com/advisories/GHSA-crhj-59gh-8x96
  • github.com/go-git/go-git/security/advisories/GHSA-crhj-59gh-8x96
  • nvd.nist.gov/vuln/detail/CVE-2026-45571

Code Behaviors & Features

Detect and mitigate CVE-2026-45571 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 5.19.1

Fixed versions

  • 5.19.1

Solution

Upgrade to version 5.19.1 or above.

Impact 5.4 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L

Learn more about CVSS

Weakness

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Source file

go/github.com/go-git/go-git/v5/CVE-2026-45571.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Thu, 28 May 2026 00:17:38 +0000.