CVE-2015-1396

7.5 HIGH

📋 TL;DR

CVE-2015-1396 is a directory traversal vulnerability in GNU patch versions before 2.7.4 that allows attackers to write to arbitrary files via symlink attacks in patch files. This affects systems using vulnerable GNU patch versions to apply patches from untrusted sources. The vulnerability exists due to an incomplete fix for CVE-2015-1196.

💻 Affected Systems

Products:
  • GNU patch
Versions: Versions before 2.7.4
Operating Systems: Linux, Unix-like systems, Any OS using GNU patch
Default Config Vulnerable: ⚠️ Yes
Notes: Systems applying patches from untrusted sources are most vulnerable. The vulnerability is in the patch utility itself, not specific applications.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote attacker gains arbitrary file write capability, potentially leading to system compromise, data corruption, or privilege escalation by overwriting critical system files.

🟠

Likely Case

Local or remote attacker with ability to supply malicious patch files can overwrite files accessible to the patch process user, potentially modifying configuration files or planting backdoors.

🟢

If Mitigated

With proper controls limiting patch sources to trusted entities and running patch with minimal privileges, impact is limited to files accessible by the restricted user.

🌐 Internet-Facing: MEDIUM - Risk exists if patch is applied to internet-facing systems from untrusted sources, but exploitation requires ability to supply patch files.
🏢 Internal Only: MEDIUM - Internal systems applying patches from untrusted internal sources or compromised repositories remain vulnerable.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires ability to supply malicious patch files to the vulnerable system. Public exploit details are available in security advisories.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.7.4 and later

Vendor Advisory: http://www.ubuntu.com/usn/USN-2651-1

Restart Required: No

Instructions:

1. Update GNU patch to version 2.7.4 or later using your distribution's package manager. 2. For Ubuntu: sudo apt-get update && sudo apt-get install patch. 3. For other distributions, use appropriate package manager commands.

🔧 Temporary Workarounds

Restrict patch sources

all

Only apply patches from trusted, verified sources. Validate patch integrity using checksums before application.

Run patch with minimal privileges

linux

Execute patch utility with non-privileged user account to limit potential damage from file writes.

sudo -u lowprivilegeuser patch -p1 < patchfile

🧯 If You Can't Patch

  • Implement strict source control for all patch files, only applying patches from trusted repositories with verified integrity.
  • Monitor patch utility usage and file system changes for suspicious activity, particularly unexpected file writes.

🔍 How to Verify

Check if Vulnerable:

Check GNU patch version: patch --version | head -1. If version is earlier than 2.7.4, system is vulnerable.

Check Version:

patch --version | head -1

Verify Fix Applied:

After updating, verify patch version is 2.7.4 or later using: patch --version | head -1.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected file writes during patch operations
  • Patch failures with symlink-related errors
  • File permission changes in unexpected locations

Network Indicators:

  • Downloads of patch files from untrusted sources
  • Unusual network traffic patterns during patch application

SIEM Query:

Process execution where process_name='patch' AND (file_write_path CONTAINS '../' OR file_write_path CONTAINS symlink)

🔗 References

📤 Share & Export