CVE-2026-56289

Loop with Unreachable Exit Condition in GNU patch

Published Jul 9, 2026 CVSS 4.0 · 4.6 Medium EPSS < 1% KEV · Not listed
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

Analysis

AI-generated

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

Remediation

No solution or workaround provided in the CVE record.

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 August 1, 2026 at 14:44 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Gnu
Gnu patch
Vendors & Products Gnu
Gnu patch
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'}

Weaknesses
  • CWE-835

    Loop with Unreachable Exit Condition ('Infinite Loop')

Sources

Status
PUBLISHED
Assigner
CERT-PL
Published
Updated
Jul 9, 2026, 12:21 PM
Reserved
Jun 20, 2026, 10:58 AM
Status
Analyzed
Published
Jul 9, 2026, 11:16 AM
Modified
Oct 25, 2026, 5:10 PM