CVE-2025-58058

5.3 MEDIUM

📋 TL;DR

This vulnerability in the xz Go package allows attackers to prepend arbitrary data before LZMA-encoded streams, causing excessive memory allocation during header parsing. Systems using xz versions before 0.5.14 for processing untrusted xz files are affected. The issue stems from missing validation in the LZMA header parsing logic.

💻 Affected Systems

Products:
  • ulikunitz/xz Go package
Versions: All versions before 0.5.14
Operating Systems: All platforms using Go
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using the xz package to process xz files from untrusted sources.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Denial of service through memory exhaustion leading to application crashes or system instability when processing malicious xz files.

🟠

Likely Case

Increased memory consumption causing performance degradation or application crashes when processing malformed xz files.

🟢

If Mitigated

Minimal impact with proper input validation and memory limits in place.

🌐 Internet-Facing: MEDIUM - Applications accepting xz files from untrusted sources could be targeted for DoS attacks.
🏢 Internal Only: LOW - Requires processing of malicious xz files, which is less likely in controlled internal environments.

🎯 Exploit Status

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

Exploitation requires the ability to provide malicious xz files to vulnerable applications.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.5.14

Vendor Advisory: https://github.com/ulikunitz/xz/security/advisories/GHSA-jc7w-c686-c4v9

Restart Required: Yes

Instructions:

1. Update Go dependencies: go get github.com/ulikunitz/xz@v0.5.14
2. Update go.mod to require version 0.5.14
3. Rebuild and redeploy affected applications
4. Restart services using the updated package

🔧 Temporary Workarounds

Input validation wrapper

all

Implement custom validation to check xz file integrity before processing

// Go code to validate xz files before processing
// Check file size limits and implement custom header validation

Memory limit enforcement

all

Set memory limits on processes handling xz file decompression

// In Go: Use runtime/debug.SetMemoryLimit()
// System: ulimit -v [memory_limit_in_kb]

🧯 If You Can't Patch

  • Implement strict file size limits for xz file uploads/processing
  • Isolate xz processing to containers with memory limits and restart policies

🔍 How to Verify

Check if Vulnerable:

Check go.mod or vendor dependencies for xz version: grep 'ulikunitz/xz' go.mod

Check Version:

go list -m github.com/ulikunitz/xz

Verify Fix Applied:

Verify xz version is 0.5.14 or later: go list -m github.com/ulikunitz/xz

📡 Detection & Monitoring

Log Indicators:

  • Sudden memory spikes in applications processing xz files
  • Application crashes during xz file processing
  • High memory allocation errors in logs

Network Indicators:

  • Unusually large xz file uploads to vulnerable endpoints

SIEM Query:

source="application_logs" AND ("memory allocation failed" OR "out of memory") AND process="*xz*"

🔗 References

📤 Share & Export