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

Published May 19, 2026
·
Updated

Impact 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.

Patches Users should upgrade to a patched version in order to mitigate this vulnerability. Versions prior to v5 are likely to be affected, users are recommended to upgrade to a supported go-git version.

Credits Thanks to @kodareef5, @AyushParkara and @N0zoM1z0 for reporting this to the go-git project in three separate reports. 🙇

Other sources

go-git is an extensible git implementation library written in pure Go. Prior to 5.19.1 and 6.0.0-alpha.4, 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. This vulnerability is fixed in 5.19.1 and 6.0.0-alpha.4.

MITRE

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

Microsoft

Affected Software

8 affected componentsFixes available
go/github.com/go-git/go-git<=44.7.0
go/github.com/go-git/go-git/v6<=6.0.0-alpha.3
6.0.0-alpha.4
go/github.com/go-git/go-git/v5<=5.19.0
5.19.1
go-git project Go-git Go<5.19.1
go-git project Go-git Go=6.0.0-alpha1
go-git project Go-git Go=6.0.0-alpha2
go-git project Go-git Go=6.0.0-alpha3
Microsoft azl3 packer 1.9.5-16<1.9.5-17
1.9.5-17

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/go-git/go-git/v6 to a version that resolves this vulnerability.

    Fixed in 6.0.0-alpha.4
  2. Upgrade

    Upgrade go/github.com/go-git/go-git/v5 to a version that resolves this vulnerability.

    Fixed in 5.19.1
  3. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.9.5-17
  4. Upgrade

    Upgrade go-git to a version that resolves this vulnerability.

    Fixed in 5.19.1
  5. Upgrade

    Upgrade go-git to a version that resolves this vulnerability.

    Fixed in 6.0.0-alpha.4
  6. Compensating control

    Use non-descendant `go-billy` filesystem instances, or different filesystem types, for the `Storer` and `Worktree` to help isolate against `.git` directory manipulation.

Event History

May 19, 2026
Advisory Published
via GitHub·03:38 PM
Data Sourced
via GitHub·03:38 PM
DescriptionSeverityWeaknessAffected Software
May 27, 2026
CVE Published
via MITRE·02:57 PM
Data Sourced
via MITRE·02:57 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:16 PM
DescriptionSeverityWeaknessAffected Software
May 28, 2026
Data Sourced
via Microsoft·08:07 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·08:07 AM
Affected Software
Updated
via Microsoft·08:07 AM
DescriptionSeverity

Frequently Asked Questions

1

What is the severity of CVE-2026-45571?

The severity of CVE-2026-45571 is considered high due to its potential impact on repository data integrity.

2

How do I fix CVE-2026-45571?

To fix CVE-2026-45571, upgrade `go-git` to version 6.0.0-alpha.4 or later for v6, or to version 5.19.1 or later for v5.

3

What versions are affected by CVE-2026-45571?

CVE-2026-45571 affects `go-git` versions up to and including 44.7.0 for the main package, and versions 6.0.0-alpha.3 and earlier for v6, and 5.19.0 and earlier for v5.

4

What type of issue is CVE-2026-45571?

CVE-2026-45571 is a path validation issue that can lead to unintended file access outside the designated checkout target.

5

Can CVE-2026-45571 affect the .git directory?

Yes, CVE-2026-45571 can allow crafted repository data to affect files within the repository's .git directory.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203