Skip to main content
Vulnerability Database/CVE-2026-115207

CVE-2026-115207: GNU patch Path Traversal Vulnerability

CVE-2026-115207 is a path traversal flaw in GNU patch allowing arbitrary file creation outside intended directories. Attackers exploit crafted patch files to write files anywhere with user permissions. This post covers technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-115207 Overview

CVE-2026-115207 is a path traversal vulnerability [CWE-22] in GNU patch. The flaw allows an attacker to achieve arbitrary file creation outside the intended working directory. Exploitation requires a user or automated workflow to apply a specially crafted patch file. The utility fails to validate absolute file paths in patch headers during automatic patch reversal. As a result, patch creates files in arbitrary locations with the permissions of the executing user.

Critical Impact

Attackers can write files to arbitrary filesystem locations by tricking users or CI/CD pipelines into applying malicious patch files, enabling integrity compromise of system or application files.

Affected Products

  • GNU patch utility
  • Linux distributions bundling vulnerable patch versions (see Red Hat advisory for specific package status)
  • Automated build and CI/CD workflows that process untrusted patch files

Discovery Timeline

  • 2026-10-22 - CVE CVE-2026-115207 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-115207

Vulnerability Analysis

The vulnerability resides in the automatic patch reversal logic of GNU patch. When processing a patch file, patch reads file path headers to determine which files to modify or create. The utility is expected to reject absolute paths to prevent writes outside the current working tree. During the reversal path, this validation is missing. An attacker can craft a patch header referencing an absolute path such as /etc/cron.d/malicious or /home/victim/.ssh/authorized_keys. When the user applies the patch, patch writes the attacker-controlled content to that location using the user's own permissions. This is a classic path traversal issue [CWE-22] mapped to the integrity impact described in the advisory.

Root Cause

The root cause is missing validation of file path components in patch headers during the automatic reversal code path. GNU patch accepts absolute paths rather than rejecting them, bypassing the implicit assumption that patches operate only within the working directory tree. There is no canonicalization step that resolves and confines the destination path to the project root before file creation occurs.

Attack Vector

Exploitation is local and requires user interaction. An attacker distributes a malicious patch file through channels such as pull requests, email attachments, downloaded archives, or compromised upstream sources. When a developer, maintainer, or automated workflow invokes patch against the file, the utility creates attacker-chosen files on disk. Impact scales with the privileges of the executing user. Patches applied by root or by privileged CI runners can overwrite system binaries, cron jobs, SSH keys, or shell configuration files. See the Red Hat advisory and the Red Hat Bug Report #2558775 for additional technical context.

// No verified public exploit code is available at the time of publication.
// Refer to the Red Hat advisory for technical analysis of the patch header parsing flaw.

Detection Methods for CVE-2026-115207

Indicators of Compromise

  • Patch files containing absolute paths such as +++ /etc/... or --- /root/... in diff headers
  • Unexpected file creation events in sensitive directories (/etc, ~/.ssh, /var/spool/cron) correlated with patch process execution
  • Build or CI logs showing patch invocations followed by file writes outside the source tree

Detection Strategies

  • Scan patch files and pull request diffs for leading / characters in ---, +++, Index:, or diff --git header lines before application
  • Monitor process telemetry for patch processes that open or create files outside their working directory
  • Audit CI/CD pipelines for automated patch steps that process patches from untrusted sources without path validation

Monitoring Recommendations

  • Enable file integrity monitoring on sensitive locations including /etc/cron.d, /etc/sudoers.d, ~/.ssh, and shell startup files
  • Collect endpoint EDR telemetry for patch command executions with child file creation events
  • Alert on patch processes launched by build service accounts that write outside expected build directories

How to Mitigate CVE-2026-115207

Immediate Actions Required

  • Apply vendor-supplied updates for GNU patch as soon as distribution packages become available
  • Review automated workflows that apply patches from untrusted sources and add path validation preprocessing
  • Avoid running patch as root or with elevated privileges when processing externally sourced patch files

Patch Information

At the time of publication, consult the Red Hat CVE-2026-115207 advisory for distribution package status and fix availability. Rebuild and redistribute vulnerable packages once upstream GNU patch releases a corrected version that validates path components during reversal.

Workarounds

  • Pre-scan patch files for absolute paths and reject any patch whose headers reference paths beginning with /
  • Apply patches inside a sandboxed container or chroot so arbitrary file writes are confined to a disposable filesystem
  • Use the --dry-run flag with manual review before applying patches from untrusted contributors
  • Restrict CI/CD service account permissions so that patch cannot modify files outside the intended source tree
bash
# Configuration example: reject patches containing absolute paths before application
grep -E '^(---|\+\+\+|Index:|diff --git [ab]) /' incoming.patch && {
  echo "Rejecting patch: absolute path detected"
  exit 1
}
patch --dry-run -p1 < incoming.patch && patch -p1 < incoming.patch

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.