Name
patch
Version
2.7.6
Type
library
Description
Tool for applying a patch file
Licenses
GPL-3.0-only
PURL
-
CPE
cpe:2.3:*:gnu:patch:2.7.6:*:*:*:*:*:*:*
Other Versions#
Patches#
#
Title
Author
Resolve
1
Fix segfault with mangled rename patch
Andreas Gruenbacher <agruen@gnu.org>
CVE-2018-6951
2
Don't leak temporary file on failed multi-file ed-style patch
Jean Delvare <jdelvare@suse.de>
CVE-2018-1000156
3
Unset need_charset_alias when building for musl
Khem Raj <raj.khem@gmail.com>
4
Don't follow symlinks unless --follow-symlinks is given
Andreas Gruenbacher <agruen@gnu.org>
CVE-2019-13636
5
Don't leak temporary file on failed ed-style patch
Jean Delvare <jdelvare@suse.de>
CVE-2018-1000156
6
Allow input files to be missing for ed-style patches
Andreas Gruenbacher <agruen@gnu.org>
CVE-2018-1000156
7
Fix arbitrary command execution in ed-style patches (CVE-2018-1000156)
Andreas Gruenbacher <agruen@gnu.org>
CVE-2018-1000156
8
Invoke ed directly instead of using the shell
Andreas Gruenbacher <agruen@gnu.org>
CVE-2018-20969
CVE-2019-13638
9
Avoid invalid memory access in context format diffs
Andreas Gruenbacher <agruen@gnu.org>
CVE-2019-20633
10
Fix swapping fake lines in pch_swap
Andreas Gruenbacher <agruen@gnu.org>
CVE-2018-6952
Vulnerabilities#
Name
Analysis
Description
Exploitable
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
Exploitable
GNU patch is vulnerable to a NULL pointer dereference when processing a specially crafted unified-diff patch file. Improper handling of consecutive end-of-file newline markers can corrupt internal hunk (single block of changes in diff) data structures, causing the application to pass a NULL pointer to fwrite() during patch processing.
An attacker can trigger this condition with a malicious patch file, causing the utility to crash and resulting in a denial of service.
This issue has been fixed in the commit e6d6a4e021660679d7fc9150f981d4920f722313
Patched
GNU patch through 2.7.6 contains a free(p_line[p_end]) Double Free vulnerability in the function another_hunk in pch.c that can cause a denial of service via a crafted patch file. NOTE: this issue exists because of an incomplete fix for CVE-2018-6952.
Patched
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.
Patched
In GNU patch through 2.7.6, the following of symlinks is mishandled in certain cases other than input files. This affects inp.c and util.c.
Patched
A double free exists in the another_hunk function in pch.c in GNU patch through 2.7.6.
Patched
An issue was discovered in GNU patch through 2.7.6. There is a segmentation fault, associated with a NULL pointer dereference, leading to a denial of service in the intuit_diff_type function in pch.c, aka a "mangled rename" issue.
Patched
do_ed_script in pch.c in GNU patch through 2.7.6 does not block strings beginning with a ! character. NOTE: this is the same commit as for CVE-2019-13638, but the ! syntax is specific to ed, and is unrelated to a shell metacharacter.
Patched
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.