Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/ulikunitz/xz
  4. ›
  5. CVE-2025-58058

CVE-2025-58058: github.com/ulikunitz/xz leaks memory when decoding a corrupted multiple LZMA archives

August 28, 2025

It is possible to put data in front of an LZMA-encoded byte stream without detecting the situation while reading the header. This can lead to increased memory consumption because the current implementation allocates the full decoding buffer directly after reading the header. The LZMA header doesn’t include a magic number or has a checksum to detect such an issue according to the specification.

Note that the code recognizes the issue later while reading the stream, but at this time the memory allocation has already been done.

When unpacking a large number of LZMA archives, even in a single goroutine, if the first byte of the archive file is 0 (a zero byte added to the beginning), an error writeMatch: distance out of range occurs. Memory consumption spikes sharply, and the GC clearly cannot handle this situation.

References

  • github.com/advisories/GHSA-jc7w-c686-c4v9
  • github.com/ulikunitz/xz
  • github.com/ulikunitz/xz/commit/88ddf1d0d98d688db65de034f48960b2760d2ae2
  • github.com/ulikunitz/xz/security/advisories/GHSA-jc7w-c686-c4v9
  • nvd.nist.gov/vuln/detail/CVE-2025-58058

Code Behaviors & Features

Detect and mitigate CVE-2025-58058 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 0.5.14

Fixed versions

  • 0.5.14

Solution

Upgrade to version 0.5.14 or above.

Impact 5.3 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Learn more about CVSS

Weakness

  • CWE-770: Allocation of Resources Without Limits or Throttling

Source file

go/github.com/ulikunitz/xz/CVE-2025-58058.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Fri, 29 Aug 2025 00:20:12 +0000.