CVE-2018-1000156
published 2018-04-06CVE-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…
PriorityP342high7.8CVSS 3.0
AVLACLPRNUIRSUCHIHAH
EPSS
5.56%
92.0th percentile
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. This attack appear to be exploitable via a patch file processed via the patch utility. This is similar to FreeBSD's CVE-2015-1418 however although they share a common ancestry the code bases have diverged over time.
Affected
61 ranges· showing 25
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| canonical | ubuntu_linux | — | — |
| canonical | ubuntu_linux | — | — |
| canonical | ubuntu_linux | — | — |
| canonical | ubuntu_linux | — | — |
| debian | debian_linux | — | — |
| debian | debian_linux | — | — |
| debian | debian_linux | — | — |
| debian | debian_linux | — | — |
| debian | patch | < patch 2.7.6-5 (bookworm) | patch 2.7.6-5 (bookworm) |
| debian | patch | < patch 2.7.6-2 (bookworm) | patch 2.7.6-2 (bookworm) |
| gnu | patch | — | — |
| gnu | patch | >= 0 < 2.7.6-5 | 2.7.6-5 |
| gnu | patch | >= 0 < 2.7.6-2 | 2.7.6-2 |
| gnu | patch | >= 0 < 2.7.6-5 | 2.7.6-5 |
| gnu | patch | >= 0 < 2.7.6-2 | 2.7.6-2 |
| gnu | patch | >= 0 < 2.7.6-5 | 2.7.6-5 |
| gnu | patch | >= 0 < 2.7.6-2 | 2.7.6-2 |
| gnu | patch | >= 0 < 2.7.6-5 | 2.7.6-5 |
| gnu | patch | >= 0 < 2.7.6-2 | 2.7.6-2 |
| gnu | patch | >= 0 < 2.7.1-4ubuntu2.4 | 2.7.1-4ubuntu2.4 |
| gnu | patch | >= 0 < 2.7.5-1ubuntu0.16.04.1 | 2.7.5-1ubuntu0.16.04.1 |
| msrc | azl3_patch_2.7.6-9_on_azure_linux_3.0 | — | — |
| msrc | cbl2_patch_2.7.6-7_on_cbl_mariner_2.0 | — | — |
| msrc | cbl_mariner_1.0_arm | — | — |
| msrc | cbl_mariner_1.0_x64 | — | — |
CVSS provenance
nvdv3.07.8HIGHCVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
nvdv2.06.8MEDIUMAV:N/AC:M/Au:N/C:P/I:P/A:P
osv7.8HIGH
vendor_debian7.8HIGH
vendor_msrc7.8HIGH
vendor_redhat7.8HIGH
vendor_ubuntu5.5MEDIUM
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
Red Hat
patch: OS shell command injection when processing crafted patch files
vendor_redhat·2019-07-29·CVSS 7.8
CVE-2019-13638 [HIGH] CWE-78 patch: OS shell command injection when processing crafted patch files
patch: OS shell command injection when processing crafted patch files
GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be exploited by opening a crafted patch file that contains an ed style diff payload with shell metacharacters. The ed editor does not need to be present on the vulnerable system. This is different from CVE-2018-1000156.
A flaw was found in GNU patch through version 2.7.6. An ed-style diff payload patch file with shell metacharacters can be used to inject OS shell commands into a system. The ed editor does not need to be present on the vulnerable system for this attack to function. The highest threat from this vulnerability is to data confidentiality and integrity as well as system availability.
Statement: Red Hat Enterprise Linux 6 is not aff
Microsoft
GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be exploited by opening a crafted patch file that contains an ed style diff payload with shell metacharacters. The ed edito
vendor_msrc·2019-07-09·CVSS 7.8
CVE-2019-13638 [HIGH] CWE-78 GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be exploited by opening a crafted patch file that contains an ed style diff payload with shell metacharacters. The ed edito
GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be exploited by opening a crafted patch file that contains an ed style diff payload with shell metacharacters. The ed editor does not need to be present on the vulnerable system. This is different from CVE-2018-1000156.
FAQ: Is Azure Linux the only Microsoft product that includes this open-source library and is therefore potentially affected by this vulnerability?
One of the main benefits to our customers who choose to use the Azure Linux distro is the commitment to keep it up to date with the most recent and most secure versions of the open source libraries with which the distro is composed. Microsoft is committed to transparency in this work which is why we began publishing CSAF/VEX in October 2025. See this bl
Debian
CVE-2019-13638: patch - GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be ...
vendor_debian·2019·CVSS 7.8
CVE-2019-13638 [HIGH] CVE-2019-13638: patch - GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be ...
GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be exploited by opening a crafted patch file that contains an ed style diff payload with shell metacharacters. The ed editor does not need to be present on the vulnerable system. This is different from CVE-2018-1000156.
Scope: local
bookworm: resolved (fixed in 2.7.6-5)
bullseye: resolved (fixed in 2.7.6-5)
forky: resolved (fixed in 2.7.6-5)
sid: resolved (fixed in 2.7.6-5)
trixie: resolved (fixed in 2.7.6-5)
Ubuntu
Patch vulnerabilities
vendor_ubuntu·2018-04-16·CVSS 5.5
CVE-2016-10713 [MEDIUM] Patch vulnerabilities
Title: Patch vulnerabilities
Summary: Several security issues were fixed in Patch.
USN-3624-1 fixed a vulnerability in Patch. This update provides
the corresponding update for Ubuntu 12.04 ESM.
Original advisory details:
It was discovered that Patch incorrectly handled certain files. An attacker
could possibly use this to cause a denial of service. (CVE-2016-10713)
It was discovered that Patch incorrectly handled certain input validation. An
attacker could possibly use this to execute arbitrary code. (CVE-2018-1000156)
Instructions: In general, a standard system update will make all the necessary changes.
Microsoft
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. This attack appear t
vendor_msrc·2018-04-10·CVSS 7.8
CVE-2018-1000156 [HIGH] CWE-20 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. This attack appear t
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. This attack appear to be exploitable via a patch file processed via the patch utility. This is similar to FreeBSD's CVE-2015-1418 however although they share a common ancestry the code bases have diverged over time.
FAQ: Is Azure Linux the only Microsoft product that includes this open-source library and is therefore potentially affected by this vulnerability?
One of the main benefits to our customers who choose to use the Azure Linux distro is the commitment to keep it up to date with the most recent and most secure versions of the open source libraries with which the distro is composed. Microsoft is committed
Ubuntu
Patch vulnerabilities
vendor_ubuntu·2018-04-10·CVSS 5.5
CVE-2016-10713 [MEDIUM] Patch vulnerabilities
Title: Patch vulnerabilities
Summary: Several security issues were fixed in Patch.
It was discovered that Patch incorrectly handled certain files. An attacker
could possibly use this to cause a denial of service. (CVE-2016-10713)
It was discovered that Patch incorrectly handled certain input validation. An
attacker could possibly use this to execute arbitrary code. (CVE-2018-1000156)
It was discovered that Patch incorrectly handled certain inputs. An attacker
could possibly use this to cause a denial of service. (CVE-2018-6951)
Instructions: In general, a standard system update will make all the necessary changes.
Red Hat
patch: Malicious patch files cause ed to execute arbitrary commands
vendor_redhat·2018-04-05·CVSS 7.8
CVE-2018-1000156 [HIGH] CWE-77 patch: Malicious patch files cause ed to execute arbitrary commands
patch: Malicious patch files cause ed to execute arbitrary commands
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. This attack appear to be exploitable via a patch file processed via the patch utility. This is similar to FreeBSD's CVE-2015-1418 however although they share a common ancestry the code bases have diverged over time.
Package: patch (Red Hat Enterprise Linux 5) - Will not fix
Package: patch (Red Hat Enterprise Linux 8) - Not affected
Debian
CVE-2018-1000156: patch - GNU Patch version 2.7.6 contains an input validation vulnerability when processi...
vendor_debian·2018·CVSS 7.8
CVE-2018-1000156 [HIGH] CVE-2018-1000156: patch - GNU Patch version 2.7.6 contains an input validation vulnerability when processi...
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. This attack appear to be exploitable via a patch file processed via the patch utility. This is similar to FreeBSD's CVE-2015-1418 however although they share a common ancestry the code bases have diverged over time.
Scope: local
bookworm: resolved (fixed in 2.7.6-2)
bullseye: resolved (fixed in 2.7.6-2)
forky: resolved (fixed in 2.7.6-2)
sid: resolved (fixed in 2.7.6-2)
trixie: resolved (fixed in 2.7.6-2)
GHSA
GHSA-vqpq-8jvg-rwmx: GNU patch through 2
ghsa_unreviewed·2022-05-24·CVSS 7.8
CVE-2019-13638 [HIGH] CWE-78 GHSA-vqpq-8jvg-rwmx: GNU patch through 2
GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be exploited by opening a crafted patch file that contains an ed style diff payload with shell metacharacters. The ed editor does not need to be present on the vulnerable system. This is different from CVE-2018-1000156.
GHSA
GHSA-r9rq-mhxg-686q: GNU Patch version 2
ghsa_unreviewed·2022-05-14·CVSS 7.8
CVE-2018-1000156 [HIGH] CWE-20 GHSA-r9rq-mhxg-686q: GNU Patch version 2
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. This attack appear to be exploitable via a patch file processed via the patch utility. This is similar to FreeBSD's CVE-2015-1418 however although they share a common ancestry the code bases have diverged over time.
OSV
CVE-2019-13638: GNU patch through 2
osv·2019-07-26·CVSS 7.8
CVE-2019-13638 [HIGH] CVE-2019-13638: GNU patch through 2
GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be exploited by opening a crafted patch file that contains an ed style diff payload with shell metacharacters. The ed editor does not need to be present on the vulnerable system. This is different from CVE-2018-1000156.
OSV
patch vulnerabilities
osv·2018-04-10·CVSS 5.5
CVE-2016-10713 [MEDIUM] patch vulnerabilities
patch vulnerabilities
It was discovered that Patch incorrectly handled certain files. An attacker
could possibly use this to cause a denial of service. (CVE-2016-10713)
It was discovered that Patch incorrectly handled certain input validation. An
attacker could possibly use this to execute arbitrary code. (CVE-2018-1000156)
It was discovered that Patch incorrectly handled certain inputs. An attacker
could possibly use this to cause a denial of service. (CVE-2018-6951)
OSV
CVE-2018-1000156: GNU Patch version 2
osv·2018-04-06·CVSS 7.8
CVE-2018-1000156 [HIGH] CVE-2018-1000156: GNU Patch version 2
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. This attack appear to be exploitable via a patch file processed via the patch utility. This is similar to FreeBSD's CVE-2015-1418 however although they share a common ancestry the code bases have diverged over time.
No detection rules found.
No public exploits indexed.
Bugzilla
CVE-2019-13638 patch: OS shell command injection when processing crafted patch files
bugzilla·2019-07-29·CVSS 7.8
CVE-2019-13638 [HIGH] CVE-2019-13638 patch: OS shell command injection when processing crafted patch files
CVE-2019-13638 patch: OS shell command injection when processing crafted patch files
A vulnerability was found in GNU patch through 2.7.6 is vulnerable to OS shell command injection that can be exploited by opening a crafted patch file that contains an ed style diff payload with shell metacharacters. The ed editor does not need to be present on the vulnerable system. This is different from CVE-2018-1000156.
Reference:
https://git.savannah.gnu.org/cgit/patch.git/commit/?id=3fcd042d26d70856e826a42b5f93dc4854d80bf0
Discussion:
Created patch tracking bugs for this issue:
Affects: fedora-all [bug 1733917]
---
During patch file processing, patch application calls the 'ed' file editor. As the invocation was done using a shell command to spawn an ed processm patch was susceptible to command
Bugzilla
CVE-2018-1000156 patch: Malicious patch files cause ed to execute arbitrary commands [fedora-all]
bugzilla·2018-04-06·CVSS 7.8
CVE-2018-1000156 [HIGH] CVE-2018-1000156 patch: Malicious patch files cause ed to execute arbitrary commands [fedora-all]
CVE-2018-1000156 patch: Malicious patch files cause ed to execute arbitrary commands [fedora-all]
This is an automatically created tracking bug! It was created to ensure
that one or more security vulnerabilities are fixed in affected versions
of fedora-all.
For comments that are specific to the vulnerability please use bugs filed
against the "Security Response" product referenced in the "Blocks" field.
For more information see:
http://fedoraproject.org/wiki/Security/TrackingBugs
When submitting as an update, use the fedpkg template provided in the next
comment(s). This will include the bug IDs of this tracking bug as well as
the relevant top-level CVE bugs.
Please also mention the CVE IDs being fixed in the RPM changelog and the
fedpkg commit message.
NOTE: this issue affects multipl
Bugzilla
CVE-2018-1000156 patch: Malicious patch files cause ed to execute arbitrary commands
bugzilla·2018-04-06·CVSS 7.8
CVE-2018-1000156 [HIGH] CVE-2018-1000156 patch: Malicious patch files cause ed to execute arbitrary commands
CVE-2018-1000156 patch: Malicious patch files cause ed to execute arbitrary commands
GNU patch does not properly sanitize patch files allowing for malicious patches to pass arbitrary shell commands to ed. An attacker could exploit this by tricking a user into applying malicious patches with the patch command.
Discussion:
Created patch tracking bugs for this issue:
Affects: fedora-all [bug 1564327]
---
There is some discussion at: http://rachelbythebay.com/w/2018/04/05/bangpatch/
The OpenBSD patch tries to fix up interpretation of s// commands on their way to ed. The FreeBSD patch does this and also switches to /usr/bin/red (restricted-mode ed), which is supposed to be safer.
On first glance, GNU patch's interpretation of the stream passed to ed is much more naive. The "correct" thi
http://packetstormsecurity.com/files/154124/GNU-patch-Command-Injection-Directory-Traversal.htmlhttp://rachelbythebay.com/w/2018/04/05/bangpatch/https://access.redhat.com/errata/RHSA-2018:1199https://access.redhat.com/errata/RHSA-2018:1200https://access.redhat.com/errata/RHSA-2018:2091https://access.redhat.com/errata/RHSA-2018:2092https://access.redhat.com/errata/RHSA-2018:2093https://access.redhat.com/errata/RHSA-2018:2094https://access.redhat.com/errata/RHSA-2018:2095https://access.redhat.com/errata/RHSA-2018:2096https://access.redhat.com/errata/RHSA-2018:2097https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894667#19https://lists.debian.org/debian-lts-announce/2018/04/msg00013.htmlhttps://savannah.gnu.org/bugs/index.php?53566https://seclists.org/bugtraq/2019/Aug/29https://seclists.org/bugtraq/2019/Jul/54https://security.gentoo.org/glsa/201904-17https://usn.ubuntu.com/3624-1/https://usn.ubuntu.com/3624-2/https://web.archive.org/web/20180405231329/https://twitter.com/kurtseifried/status/982028968877436928http://packetstormsecurity.com/files/154124/GNU-patch-Command-Injection-Directory-Traversal.htmlhttp://rachelbythebay.com/w/2018/04/05/bangpatch/https://access.redhat.com/errata/RHSA-2018:1199https://access.redhat.com/errata/RHSA-2018:1200https://access.redhat.com/errata/RHSA-2018:2091https://access.redhat.com/errata/RHSA-2018:2092https://access.redhat.com/errata/RHSA-2018:2093https://access.redhat.com/errata/RHSA-2018:2094https://access.redhat.com/errata/RHSA-2018:2095https://access.redhat.com/errata/RHSA-2018:2096https://access.redhat.com/errata/RHSA-2018:2097https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894667#19https://lists.debian.org/debian-lts-announce/2018/04/msg00013.htmlhttps://savannah.gnu.org/bugs/index.php?53566https://seclists.org/bugtraq/2019/Aug/29https://seclists.org/bugtraq/2019/Jul/54https://security.gentoo.org/glsa/201904-17https://twitter.com/kurtseifried/status/982028968877436928https://usn.ubuntu.com/3624-1/https://usn.ubuntu.com/3624-2/
2018-04-06
Published