Where
-Infinity
0
Severity
7.8
Path Traversal
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Directory traversal vulnerability in GNU patch versions which support Git-style patching before 2.7.3 allows remote attackers to write to arbitrary files with the permissions of the target user via a .. (dot dot) in a diff file name.

1 / 2
Source: MITRE
First published (updated )
Severity
7.8
Input Validation
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

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.

1 / 3
Source: Red Hat
First published (updated )
Severity
7.8
Command Injection, OS Command Injection
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

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

1 / 3
Source: Red Hat
First published (updated )
Severity
7.8
OS Command Injection
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

A vulnerability was found in doedscript 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.

Reference: https://git.savannah.gnu.org/cgit/patch.git/commit/?id=3fcd042d26d70856e826a42b5f93dc4854d80bf0 https://seclists.org/bugtraq/2019/Aug/29

1 / 2
Source: Red Hat
First published (updated )
Severity
7.5
Path Traversal
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

A Directory Traversal vulnerability exists in the GNU patch before 2.7.4. A remote attacker can write to arbitrary files via a symlink attack in a patch file. NOTE: this issue exists because of an incomplete fix for CVE-2015-1196.

1 / 2
Source: MITRE
First published (updated )
Severity
7.5
Double Free
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

A double free exists in the anotherhunk function in pch.c in GNU patch through 2.7.6.

1 / 2
Source: MITRE
First published (updated )
Severity
7.5
Null Pointer Dereference
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

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 intuitdifftype function in pch.c, aka a "mangled rename" issue.

1 / 2
Source: Launchpad
First published (updated )
Severity
7.1
CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H

GNU patch 2.7.2 and earlier allows remote attackers to cause a denial of service (memory consumption and segmentation fault) via a crafted diff file.

1 / 2
Source: Debian
First published (updated )
Severity
7

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.

First published (updated )
Severity
7

A vulnerability was found in doedscript 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.

Reference: https://git.savannah.gnu.org/cgit/patch.git/commit/?id=3fcd042d26d70856e826a42b5f93dc4854d80bf0 https://seclists.org/bugtraq/2019/Aug/29

First published (updated )
Severity
7
Command Injection

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

First published (updated )
Severity
5.9
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N

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.

1 / 2
Source: Launchpad
First published (updated )
Severity
5.5
Path Traversal
AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N

A flaw was found in GNU patch. An attacker can achieve arbitrary file creation outside the intended working directory by enticing a user or automated workflow to apply a specially crafted patch file. Due to missing validation during automatic patch reversal, absolute file paths in patch headers are accepted rather than rejected. Consequently, the utility can create files in arbitrary locations with the permissions of the executing user.

1 / 4
Source: Ubuntu
First published (updated )
Severity
5.5
Buffer Overflow
AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H

A flaw was found in GNU patch before 2.7.6. An Out-of-bounds access within pchwriteline() function in pch.c file which can lead to a Denial of Service via a crafted input file.

External References:

https://savannah.gnu.org/bugs/index.php?45990

Upstream Patch:

https://git.savannah.gnu.org/cgit/patch.git/commit/src/pch.c?id=a0d7fe4589651c6

1 / 3
Source: Red Hat
First published (updated )
Severity
5.5
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H

An Invalid Pointer vulnerability exists in GNU patch 2.7 via the anotherhunk function, which causes a Denial of Service.

First published (updated )
Severity
5.5
Double Free
AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H

GNU patch through 2.7.6 contains a free(pline[pend]) Double Free vulnerability in the function anotherhunk 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.

First published (updated )
Severity
4.6
AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:L/SC:N/SI:N/SA:L/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

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

1 / 2
Source: MITRE
First published (updated )
Severity
4.6
Null Pointer Dereference
AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

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

1 / 2
Source: MITRE
First published (updated )
Severity
4.3
AV:N/AC:M/Au:N/C:N/I:P/A:N

GNU patch 2.7.1 allows remote attackers to write to arbitrary files via a symlink attack in a patch file.

1 / 2
Source: MITRE
First published (updated )
Severity
4

A flaw was found in GNU patch. The reversal fallback in intuitdifftype() in src/pch.c selects a filename from the patch headers without applying the nameisvalid() check that normally rejects absolute paths. A crafted unified diff that appears to delete a nonexistent file, with an absolute filename in both headers and an epoch timestamp for the new file, can trigger automatic reversal when applied with patch -p0 -t. The unvalidated absolute filename reaches the filesystem operations, allowing attacker-controlled file creation outside the working directory with the permissions of the account running patch. Exploitation requires a user or workflow to apply the crafted patch; it does not bypass operating-system filesystem permissions.

First published (updated )
Severity
1

A flaw was found in GNU patch before 2.7.6. An Out-of-bounds access within pchwriteline() function in pch.c file which can lead to a Denial of Service via a crafted input file.

External References:

https://savannah.gnu.org/bugs/index.php?45990

Upstream Patch:

https://git.savannah.gnu.org/cgit/patch.git/commit/src/pch.c?id=a0d7fe4589651c6

First published (updated )
Severity
1
Double Free

GNU patch through version 2.7.6 is vulnerable to a double freeing of memory when supplied a crafted patch file leading to a crash.

Upstream Issue:

https://savannah.gnu.org/bugs/index.php?53133

First published (updated )
Severity
1

It was reported [1] that a crafted diff file (attached) can make patch to eat memory and later segfault. Upstream commit that fixes this: http://git.savannah.gnu.org/cgit/patch.git/commit/?id=0c08d7a902c6fdd49b704623a12d8d672ef18944

[1]: https://savannah.gnu.org/bugs/?44051

First published (updated )

https://lists.gnu.org/archive/html/bug-patch/2026-10/msg00014.html announces: GNU patch 2.8.1 has been released to fix the following critical bug: Prevent creation of out-of-tree files (CVE-2026-115207)

When reverse-applying a patch that deletes a file, patch created that file without checking if the pathname is safe. Fix that by adding the missing check. The project page is at https://savannah.gnu.org/projects/patch/

The sources can be downloaded from https://ftp.gnu.org/gnu/patch/

The sha256sum checksums are as follows: This release is also GPG signed. You can download the signature by appending '.sig' to the URL. If the 'gpg --verify' command fails because you don't have the required public key, then run this command to import it:

gpg --recv-keys D5BF9FEB0313653A

Key fingerprint = 259B 3792 B3D6 D319 212C C4DC D5BF 9FEB 0313 653A

Regards, Andreas Gruenbacher

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203