CVE-2020-7667

7.5 HIGH

📋 TL;DR

This vulnerability allows path traversal attacks during CPIO archive extraction in the go-rpmutils library. Attackers can craft malicious archives to write files outside the intended directory, potentially overwriting system files or deploying malware. Any application using the vulnerable go-rpmutils/cpio package to extract untrusted CPIO archives is affected.

💻 Affected Systems

Products:
  • github.com/sassoftware/go-rpmutils/cpio
Versions: All versions before 0.1.0
Operating Systems: All platforms where Go applications run (Linux, Windows, macOS)
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications that use the CPIO extraction functionality with untrusted archive sources.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise via overwriting critical system files (like /etc/passwd, init scripts) or deploying persistent malware/backdoors.

🟠

Likely Case

Arbitrary file write leading to data corruption, privilege escalation, or denial of service by overwriting application files.

🟢

If Mitigated

Limited to directory traversal within the extraction process if proper input validation and sandboxing are implemented.

🌐 Internet-Facing: MEDIUM - Exploitation requires uploading malicious CPIO archives to vulnerable services, which is common but not universal.
🏢 Internal Only: MEDIUM - Internal users or automated processes could exploit this if they can supply CPIO archives to vulnerable applications.

🎯 Exploit Status

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

Exploitation is straightforward - create a CPIO archive with '..' in file paths. No authentication needed if the application accepts untrusted archives.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.1.0 and later

Vendor Advisory: https://github.com/sassoftware/go-rpmutils/commit/a64058cf21b8aada501bba923c9aab66fb6febf0

Restart Required: No

Instructions:

1. Update go.mod to require github.com/sassoftware/go-rpmutils/cpio v0.1.0 or later. 2. Run 'go mod tidy'. 3. Rebuild and redeploy your application.

🔧 Temporary Workarounds

Input validation wrapper

all

Implement custom extraction logic that sanitizes paths before extraction

// Go code example: Validate path doesn't contain '..' before extraction

Sandbox extraction

linux

Extract archives in isolated containers or chroot environments

docker run --rm -v /tmp/extract:/extract alpine cpio -i -F archive.cpio -D /extract

🧯 If You Can't Patch

  • Disable CPIO extraction functionality entirely if not required
  • Implement strict access controls to limit who can submit CPIO archives to the application

🔍 How to Verify

Check if Vulnerable:

Check go.mod for 'github.com/sassoftware/go-rpmutils/cpio' version <0.1.0

Check Version:

grep 'github.com/sassoftware/go-rpmutils/cpio' go.mod

Verify Fix Applied:

Verify go.mod requires version >=0.1.0 and check for the fix commit a64058c in dependencies

📡 Detection & Monitoring

Log Indicators:

  • Unexpected file writes outside extraction directory
  • CPIO extraction errors with path traversal attempts

Network Indicators:

  • Uploads of CPIO archives to vulnerable endpoints

SIEM Query:

source="application.log" AND "cpio" AND (".." OR "path traversal")

🔗 References

📤 Share & Export