Critical Input Validation Vulnerability in GNU Patch Package

patch Updated 02 Oct 2025

Summary

06/04/2018
N/A
Yes i
Unrated
Not published

DEBIAN-CVE-2018-1000156: GNU Patch version 2.7.6 contains an input validation vulnerability when processing patch files, specifically the EDITOR_PROGRAM invocation (using ed) can result in code execution. Affects patch versions < 2.7.6-2. Fixed in 2.7.6-2. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

GNU Patch is a widely used utility that allows users to apply changes to files based on a patch file. It is essential for developers and system administrators to manage code changes efficiently. The package is known for its ability to handle patch files generated by the diff utility, making it a crucial tool in software development and maintenance. However, a recent vulnerability has been identified that compromises its security, specifically in the way it processes patch files.

Vulnerability Detail

GNU Patch version 2.7.6 contains an input validation vulnerability that arises during the processing of patch files. The vulnerability is related to the invocation of EDITOR_PROGRAM, which uses the 'ed' editor. This flaw can potentially lead to arbitrary code execution when a malicious patch file is processed by the patch utility. This vulnerability is similar to FreeBSD's CVE-2015-1418, but the code bases have diverged, leading to unique implications for GNU Patch users.

How To Fix

Minimum fixed version

2.7.6-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade patch

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary measure, users can avoid processing untrusted patch files or ensure that the EDITOR_PROGRAM is set to a safe editor that does not allow for arbitrary code execution. Additionally, users can manually inspect patch files before applying them to ensure they do not contain malicious code.

Conclusion

The identified vulnerability in GNU Patch poses a significant risk to users who process patch files without proper safeguards. It is crucial to update to the patched version to mitigate the risk of arbitrary code execution. Users are encouraged to remain vigilant and utilize tools like Vulert to monitor for vulnerabilities in their software.

See every vulnerability recorded for patch →

Share this vulnerability

FAQ

The vulnerability is an input validation issue that can lead to arbitrary code execution when processing malicious patch files.

You can use the Vulert platform to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected.

Failure to address this vulnerability could allow attackers to execute arbitrary code on your system, potentially leading to data breaches or system compromise.

Yes, version 2.7.6-2 and later are patched versions that address this vulnerability.

If immediate updates are not possible, avoid using untrusted patch files and consider setting a safe editor for the EDITOR_PROGRAM environment variable.

Related vulnerabilities

Recent vulnerabilities recorded for patch.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

2.7.6-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade patch

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback