Description
GNU patch is vulnerable to a denial of service (DoS) due to improper validation of hunk (single block of changes in diff) line offsets in unified-diff input. A specially crafted patch can specify an extremely large line number, causing the application to enter an effectively infinite processing loop while attempting to locate the requested position.
This results in excessive CPU consumption and prevents the process from completing.
An attacker can trigger this behavior by supplying a malicious patch file, causing the utility to become unresponsive and require manual termination.



This issue has been fixed in the commit faba04ef4f2b410257f76c1b9dc85e350929c4b9
Published: 2026-07-09
Score: 4.6 Medium
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

GNU patch contains a loop that can become effectively infinite when processing a hunk that references a line number beyond the length of the target file. A patch file crafted with an extremely large offset forces the utility to repeatedly attempt to locate a non‑existent position, consuming CPU until the process is stopped. The flaw lies in improper validation of hunk line offsets and is identified as CWE‑835. Although the attack causes a resource exhaustion denial of service, it does not provide code execution or privilege escalation.

Affected Systems

All releases of the GNU patch utility prior to commit faba04ef4f2b410257f76c1b9dc85e350929c4b9 are affected. The fix is included in that commit, so any build that does not incorporate this change remains vulnerable.

Risk and Exploitability

The CVSS score of 4.6 signals moderate severity, and the EPSS score of less than 1% indicates a very low probability of exploitation in the wild. The vulnerability is not listed in CISA’s KEV catalogue. An attacker would need to supply a malicious patch file to the target system, which limits the impact to environments that automatically ingest or apply patches. Once the malicious patch is processed, the process becomes unresponsive without requiring elevated privileges, providing a resource‑exhaustion denial of service.

Generated by OpenCVE AI on July 29, 2026 at 12:36 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Update GNU patch to a version that includes commit faba04ef4f2b410257f76c1b9dc85e350929c4b9, which removes the infinite‑loop condition.
  • If an instant update is not possible, run patch inside a CPU‑limited sandbox or enforce a maximum CPU time to prevent long‑running loops.
  • Optionally, pre‑validate or filter patch input before passing it to patch, rejecting hunks that reference line numbers outside a defined safe range to avoid the loop entirely.

Generated by OpenCVE AI on July 29, 2026 at 12:36 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Thu, 09 Jul 2026 12:15:00 +0000

Type Values Removed Values Added
First Time appeared Gnu
Gnu patch
Vendors & Products Gnu
Gnu patch

Thu, 09 Jul 2026 10:45:00 +0000

Type Values Removed Values Added
Description GNU patch is vulnerable to a denial of service (DoS) due to improper validation of hunk (single block of changes in diff) line offsets in unified-diff input. A specially crafted patch can specify an extremely large line number, causing the application to enter an effectively infinite processing loop while attempting to locate the requested position. This results in excessive CPU consumption and prevents the process from completing. An attacker can trigger this behavior by supplying a malicious patch file, causing the utility to become unresponsive and require manual termination. This issue has been fixed in the commit faba04ef4f2b410257f76c1b9dc85e350929c4b9
Title Loop with Unreachable Exit Condition in GNU patch
Weaknesses CWE-835
References
Metrics cvssV4_0

{'score': 4.6, 'vector': 'CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:L/SC:N/SI:N/SA:L'}


cve-icon MITRE

Status: PUBLISHED

Assigner: CERT-PL

Published:

Updated: 2026-07-09T12:21:39.125Z

Reserved: 2026-06-20T10:58:09.261Z

Link: CVE-2026-56289

cve-icon Vulnrichment

No data.

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-29T12:45:03Z

Weaknesses
  • CWE-835

    Loop with Unreachable Exit Condition ('Infinite Loop')