# CVE-2026-56289: Loop with Unreachable Exit Condition in GNU patch

> An attacker can cause a denial of service in GNU patch by supplying a malicious patch file with large line offsets, leading to infinite loops and high CPU usage.

- **Severity:** Medium 4.6 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 9 Jul 2026
- **Updated:** 9 Jul 2026
- **Also known as:** AZL-92151, DEBIAN-CVE-2026-56289, ECHO-6808-09a0-f94e, GHSA-3m3r-f94v-4mf8, JLSEC-2026-1261, RHSA-2026:37468, UBUNTU-CVE-2026-56289

## What is CVE-2026-56289?

CVE-2026-56289 is a medium-severity denial of service vulnerability in GNU patch, published on 9 Jul 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official 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

Weakness: CWE-835 (Loop with Unreachable Exit Condition)

## Which versions are affected by CVE-2026-56289?

It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `patch` | Red Hat:hummingbird:1 | All versions | 0:2.8-4.2.hum1 |

Products: Gnu Patch.

## How do I fix CVE-2026-56289?

Apply the vendor's patch.

## Is CVE-2026-56289 being exploited?

There is no known exploitation of CVE-2026-56289 in the wild and no public exploit code.

## Other vulnerabilities in GNU patch

- [CVE-2018-20969](https://insights.sbomify.com/CVE-2018-20969/): Command injection in n/a (high 7.8)
- [CVE-2018-6952](https://insights.sbomify.com/CVE-2018-6952/): Use after free in n/a (high 7.5)
- [CVE-2019-13636](https://insights.sbomify.com/CVE-2019-13636/): Path traversal in n/a (medium 5.9)
- [CVE-2021-45261](https://insights.sbomify.com/CVE-2021-45261/): Null dereference in n/a (medium 5.5)
- [CVE-2019-20633](https://insights.sbomify.com/CVE-2019-20633/): Use after free in n/a (medium 5.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-56289 and fix it if it is affected.

What it is: CVE-2026-56289 is a medium-severity denial of service vulnerability in GNU patch, published on 9 Jul 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-56289 in the wild and no public exploit code.

Affected product: GNU patch. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-56289/ (Markdown: https://insights.sbomify.com/CVE-2026-56289/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-56289
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-56289
- OSV: https://osv.dev/vulnerability/CVE-2026-56289

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-56289/
Summaries are generated and may contain mistakes; the official description above is the record.
