REDHAT-BUG-2558775: Medium severity GNU patch vulnerability

Published Oct 22, 2026
·
Updated

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.

Affected Software

1 affected component
GNU patch

Event History

Oct 22, 2026
Data Sourced
via Red Hat·07:27 AM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

Who is realistically exposed to this issue?

Users and automated workflows that apply attacker-controlled or untrusted unified diffs with GNU patch are exposed when they use the affected invocation conditions. The resulting file operations run with the permissions of the account executing patch.

2

What conditions are required for exploitation?

An attacker needs to provide a crafted unified diff that appears to delete a nonexistent file, uses an absolute filename in both headers, and gives the new file an epoch timestamp. The patch must be applied with patch -p0 -t so that automatic reversal is triggered.

3

Does this allow an attacker to bypass filesystem permissions?

No. The flaw can cause file creation outside the intended working directory, but it does not bypass operating-system filesystem permissions; creation is limited to locations writable by the account running patch.

4

What can be done before a fix is available?

Do not apply untrusted patches with patch -p0 -t, particularly in automated workflows. Review patch headers for absolute filenames and avoid configurations that permit automatic reversal of attacker-supplied diffs.

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