CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-71557

CVE-2026-71557: Path Traversal and Configuration Overwrite in go-git Filesystem Storage Engine

Amit Schendel
Amit Schendel
Senior Security Researcher

Aug 8, 2026·7 min read·84 visits

Executive Summary (TL;DR)

A path traversal flaw in go-git's reference processing allows a malicious remote server to overwrite local repository configuration files (such as .git/config) during clone or fetch operations, potentially leading to arbitrary command execution.

CVE-2026-71557 is a path traversal vulnerability in go-git, a pure-Go implementation of Git. In vulnerable versions, the filesystem-backed storage engine fails to validate reference names before mapping them to on-disk paths. An attacker hosting a malicious Git server can advertise references containing directory traversal sequences, such as 'refs/heads/../../config', to write or overwrite files outside the intended reference storage directory.

Vulnerability Overview

The go-git library is a pure-Go implementation of the Git version control system, widely used in automated continuous integration and continuous deployment (CI/CD) pipelines, developer tools, and cloud-native applications. To persist Git metadata, the library implements a storage abstraction layer. The filesystem-backed storage engine, located within the storage/filesystem package, manages Git object databases, configuration details, and logical references such as branches and tags.

In Git architectures, loose references function as pointers to specific commit hashes and are traditionally stored as physical files on disk under the .git/refs/ directory. Prior to the patch, the storage/filesystem/dotgit component processed remote reference names directly without verifying if the path resolution logic remained within the designated directory boundary. This administrative failure exposes a path traversal vulnerability classified under CWE-22, enabling unauthenticated remote actors to bypass intended directory constraints.

The attack surface is exposed during clone and fetch operations where a client connects to a remote repository. When a remote server advertises its references, the vulnerable client writes these references to the local filesystem using the exact names received from the server. By crafting malicious reference names that incorporate relative directory traversal sequences, an attacker can manipulate the file paths resolved by the client, causing files to be created or overwritten outside the designated reference storage area.

Root Cause Analysis

The root cause of CVE-2026-71557 resides in the reference persistence logic of storage/filesystem/dotgit/dotgit.go. When saving a reference, the library converts the logical reference name into a string and passes it directly to internal filesystem storage routines. Specifically, the SetRef function invokes setRef(fileName, content, old) using the raw string representation of the reference name returned by r.Name().String().

The filesystem wrapper implements directory organization by joining the base path of the .git directory with the provided reference name using helper functions such as d.fs.Join(".", name). In Go, the Join function evaluates the path, but the underlying filesystem interfaces often execute lexical path cleaning or delegate normalization to the operating system's system calls. Consequently, input strings containing relative path segments like ../ are evaluated dynamically.

When an attacker-controlled remote server advertises a reference name such as refs/heads/../../config, the library attempts to write this reference. The path resolution resolves the string relative to the repository root, effectively neutralizing the refs/heads/ prefix and targeting .git/config directly. Because the code lacked validation checks to verify whether the final resolved path remained within the bounds of the reference storage directory, the application allows arbitrary out-of-bounds writes.

Code Analysis and Patch Analysis

The vulnerability was addressed by introducing validation functions to enforce boundaries on reference names. The following code comparison demonstrates the vulnerability remediation introduced in storage/filesystem/dotgit/dotgit.go.

Before the patch, reference names were accepted and joined without verification:

// Vulnerable pattern in dotgit.go
func (d *DotGit) SetRef(r *plumbing.Reference, old *plumbing.Reference) error {
    fileName := r.Name().String()
    // The filename was passed directly, enabling directory traversal
    return d.setRef(fileName, []byte(r.Hash().String()+"\n"), old)
}

The patch introduces a strict boundary validation step before any filesystem operation occurs on the reference name:

// Patched pattern in dotgit.go
func (d *DotGit) SetRef(r *plumbing.Reference, old *plumbing.Reference) error {
    // First, validate the reference name logically and structurally
    if err := validReferenceName(r.Name()); err != nil {
        return err
    }
    fileName := r.Name().String()
    return d.setRef(fileName, []byte(r.Hash().String()+"\n"), old)
}

The remediation implements the validReferenceName validation function. This helper performs critical validation routines to sanitize reference names, ensuring they represent safe paths under the .git directory:

func validReferenceName(name plumbing.ReferenceName) error {
    // 1. Verifies the name is structurally safe and within the refs/ namespace
    if !name.IsSafe() {
        return fmt.Errorf("%w: %q is not under refs/ nor a valid pseudo-ref", ErrReferenceNameEscape, string(name))
    }
 
    s := string(name)
    for i := 0; i < len(s); i++ {
        if s[i] < 0x20 || s[i] == 0x7f {
            return fmt.Errorf("%w: %q", ErrReferenceNameEscape, s)
        }
    }
    // 2. Splits the name by OS-agnostic separators to catch relative directory jumps
    for _, part := range strings.FieldsFunc(s, isPathSep) {
        // 3. Rejects HFS+ and NTFS directory bypass tricks
        if part == "." || pathutil.IsHFSDot(part, ".") || pathutil.IsNTFSDot(part, ".", "") {
            return fmt.Errorf("%w: %q", ErrReferenceNameEscape, s)
        }
    }
    return nil
}

The patch is comprehensive because it handles operating-system-specific directory traversal techniques. It uses isPathSep to recognize both forward slashes and backslashes as path separators, preventing exploitation on Windows machines that treat backslashes as directory delimiters. Furthermore, it incorporates IsHFSDot and IsNTFSDot checks from the pathutil module to block Unicode normalization bypasses on HFS+ (macOS) and NTFS (Windows) environments, providing robust, platform-agnostic protection.

Exploitation Methodology

An attack leveraging CVE-2026-71557 requires the victim to perform a Git operation, such as a clone or a fetch, against a repository hosted on a server controlled by the attacker. No authentication is typically needed beyond the standard access permissions required to initiate the cloning process. The vulnerability triggers automatically as part of the initial reference handshake.

During the reference discovery phase, the malicious Git server sends a list of references and their corresponding commit hashes. The server includes a crafted reference name that contains relative path sequences targeting sensitive local configuration files, as shown below:

refs/heads/../../config

When the client processes this reference, it invokes SetRef to write the commit hash onto disk. The path joining logic resolves the target destination to .git/config instead of a subdirectory inside .git/refs/. The contents written to .git/config can alter repository configuration parameters, such as defining malicious core hooks or changing origin URLs, enabling downstream execution of arbitrary code when standard Git commands are subsequently executed.

Impact Assessment

The impact of CVE-2026-71557 is classified as Medium, with a CVSS v3.1 base score of 6.3. The vulnerability does not directly expose confidential data, resulting in a Confidentiality score of None. However, it provides a High Integrity impact and Low Availability impact because an attacker can corrupt, truncate, or overwrite critical configuration metadata within the local .git repository directory.

The primary risk associated with this flaw is remote code execution (RCE). By overwriting .git/config, an attacker can register custom execution hooks or shell commands within configuration options like core.pager or fsmonitor. When the victim or an automated script runs subsequent local Git operations on the repository, the modified configuration executes the payload with the privileges of the active user.

This threat is especially acute for automated build pipelines, code analysis tools, and CI/CD systems that pull external, untrusted repositories. If these systems utilize vulnerable versions of go-git to fetch and analyze commits, a compromised or malicious repository can easily execute commands on the build agents. This can result in credential theft, lateral network movement, or supply-chain compromise.

Remediation and Mitigation Guidance

The primary remediation path is upgrading the go-git library to a non-vulnerable version. Organizations using the v5 branch must upgrade to version v5.19.2 or later. Projects employing the experimental v6 branch must upgrade to version v6.0.0-alpha.5 or later. To perform the upgrade in a Go environment, run the following commands:

go get github.com/go-git/go-git/v5@v5.19.2
go mod tidy

For environments where immediate upgrades are not possible, several mitigation strategies can reduce the risk. Applications can be reconfigured to use in-memory storage rather than filesystem-backed storage. Since the in-memory storage engine (storage/memory) does not write references to physical paths on disk, it is immune to the directory traversal vector described in this vulnerability.

Additionally, organizations should implement strict network egress controls to prevent automated cloning processes from connecting to unapproved or public third-party Git hosts. Applying system-level sandboxing, such as executing clone operations inside isolated containers with limited privileges, restricts the impact of any potential arbitrary command execution occurring as a result of repository configuration hijacking.

Technical Appendix

CVSS Score
6.3/ 10

Affected Systems

Applications utilizing github.com/go-git/go-git/v5 prior to v5.19.2 with filesystem-backed storage enginesApplications utilizing github.com/go-git/go-git/v6 from v6.0.0-alpha.1 to v6.0.0-alpha.4 with filesystem-backed storage engines
AttributeDetail
CWE IDCWE-22
Attack VectorNetwork (AV:N)
CVSS Score6.3 (Medium)
Exploit StatusProof-of-Concept (PoC)
ImpactHigh Integrity (I:H), Low Availability (A:L), Remote Code Execution (RCE)
KEV StatusNot Listed
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Vulnerability Timeline

Security fixes and backport patches generated
2026-07-15
Patches merged into release branches
2026-07-17
CVE-2026-71557 officially published
2026-08-07
Public Proof of Concept (PoC) released
2026-08-08

References & Sources

  • [1]GitHub Security Advisory GHSA-qgq7-7hm3-q39j
  • [2]Public Proof of Concept Repository
  • [3]go-git Pull Request #2247
  • [4]go-git Pull Request #2254

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 23 hours ago•CVE-2026-58254
6.5

CVE-2026-58254: Authorization Bypass in NATS Server Message Tracing for Leaf Node Connections

NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.

Alon Barad
Alon Barad
5 views•10 min read
•1 day ago•CVE-2026-63341
7.5

CVE-2026-63341: Unauthenticated Denial of Service via Unbounded Topic Depth in Aedes MQTT Broker

CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.

Alon Barad
Alon Barad
11 views•12 min read
•1 day ago•CVE-2026-61725
6.1

CVE-2026-61725: Path Traversal and Arbitrary File Overwrite in sevenz-rust2

CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.

Alon Barad
Alon Barad
6 views•12 min read
•1 day ago•CVE-2026-77309
8.8

CVE-2026-77309: Unauthenticated Remote Code Execution in NASA-AMMOS AIT-GUI via Incomplete File Cleanup and Path Traversal

CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.

Amit Schendel
Amit Schendel
11 views•10 min read
•1 day ago•CVE-2026-77332
2.3

CVE-2026-77332: Surfaced-Memory Envelope Injection and Stored Prompt Injection in memtomem-stm

A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.

Alon Barad
Alon Barad
13 views•10 min read
•1 day ago•CVE-2026-77331
2.0

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.

Amit Schendel
Amit Schendel
6 views•9 min read