Lookup for vulnerable packages by Package URL.

Purlpkg:deb/debian/golang-github-ulikunitz-xz@0.5.6-2?distro=trixie
Typedeb
Namespacedebian
Namegolang-github-ulikunitz-xz
Version0.5.6-2
Qualifiers
distro trixie
Subpath
Is_vulnerabletrue
Next_non_vulnerable_version0.5.15-1
Latest_non_vulnerable_version0.5.15-1
Affected_by_vulnerabilities
0
url VCID-aag6-jhbk-qqd6
vulnerability_id VCID-aag6-jhbk-qqd6
summary
github.com/ulikunitz/xz leaks memory when decoding a corrupted multiple LZMA archives
### Summary

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](https://github.com/jljusten/LZMA-SDK/blob/master/DOC/lzma-specification.txt).

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

### Mitigations

The release v0.5.15 includes following mitigations:

- The ReaderConfig DictCap field is now interpreted as a limit for the dictionary size.
- The default is 2 Gigabytes - 1 byte (2^31-1 bytes).
- Users can check with the [Reader.Header] method what the actual values are in  their LZMA files and set a smaller limit using ReaderConfig.
- The dictionary size will not exceed the larger of the file size and the minimum dictionary size. This is another measure to prevent huge memory allocations for the dictionary.
- The code supports stream sizes only up to a pebibyte (1024^5).

Note that the original v0.5.14 version had a compiler error for 32 bit platforms, which has been fixed by v0.5.15.

### Methods affected

Only software that uses [lzma.NewReader](https://pkg.go.dev/github.com/ulikunitz/xz/lzma#NewReader) or [lzma.ReaderConfig.NewReader](https://pkg.go.dev/github.com/ulikunitz/xz/lzma#ReaderConfig.NewReader) is affected. There is no issue for software using the xz functionality.

I thank  @GregoryBuligin for his report, which is provided below.

### Summary
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.

### Details
Judging by the error  __writeMatch: distance out of range__, the problems occur in the code around this function.
https://github.com/ulikunitz/xz/blob/c8314b8f21e9c5e25b52da07544cac14db277e89/lzma/decoderdict.go#L81

### PoC
Run a function similar to this one in 1 or several goroutines on a multitude of LZMA archives that have a 0 (a zero byte) added to the beginning.
```
const ProjectLocalPath = "some/path"
const TmpDir = "tmp"

func UnpackLZMA(lzmaFile string) error {
	file, err := os.Open(lzmaFile)
	if err != nil {
		return err
	}
	defer file.Close()

	reader, err := lzma.NewReader(bufio.NewReader(file))
	if err != nil {
		return err
	}

	tmpFile, err := os.CreateTemp(TmpDir, TmpLZMAPrefix)
	if err != nil {
		return err
	}
	defer func() {
		tmpFile.Close()
		_ = os.Remove(tmpFile.Name())
	}()

	sha256Hasher := sha256.New()
	multiWriter := io.MultiWriter(tmpFile, sha256Hasher)

	if _, err = io.Copy(multiWriter, reader); err != nil {
		return err
	}

	unpackHash := hex.EncodeToString(sha256Hasher.Sum(nil))
	unpackDir := filepath.Join(
		ProjectLocalPath, unpackHash[:2],
	)
	_ = os.MkdirAll(unpackDir, DirPerm)

	unpackPath := filepath.Join(unpackDir, unpackHash)

	return os.Rename(tmpFile.Name(), unpackPath)
}
```



### Impact
Servers with a small amount of RAM that download and unpack a large number of unverified LZMA archives
references
0
reference_url https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2025-58058.json
reference_id
reference_type
scores
0
value 5.3
scoring_system cvssv3
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
url https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2025-58058.json
1
reference_url https://api.first.org/data/v1/epss?cve=CVE-2025-58058
reference_id
reference_type
scores
0
value 0.00062
scoring_system epss
scoring_elements 0.19136
published_at 2026-04-24T12:55:00Z
1
value 0.00062
scoring_system epss
scoring_elements 0.19506
published_at 2026-04-04T12:55:00Z
2
value 0.00062
scoring_system epss
scoring_elements 0.19223
published_at 2026-04-07T12:55:00Z
3
value 0.00062
scoring_system epss
scoring_elements 0.19301
published_at 2026-04-08T12:55:00Z
4
value 0.00062
scoring_system epss
scoring_elements 0.19354
published_at 2026-04-09T12:55:00Z
5
value 0.00062
scoring_system epss
scoring_elements 0.19357
published_at 2026-04-11T12:55:00Z
6
value 0.00062
scoring_system epss
scoring_elements 0.19308
published_at 2026-04-12T12:55:00Z
7
value 0.00062
scoring_system epss
scoring_elements 0.19253
published_at 2026-04-13T12:55:00Z
8
value 0.00062
scoring_system epss
scoring_elements 0.19215
published_at 2026-04-16T12:55:00Z
9
value 0.00062
scoring_system epss
scoring_elements 0.19224
published_at 2026-04-18T12:55:00Z
10
value 0.00062
scoring_system epss
scoring_elements 0.19237
published_at 2026-04-21T12:55:00Z
11
value 0.00065
scoring_system epss
scoring_elements 0.2027
published_at 2026-04-02T12:55:00Z
url https://api.first.org/data/v1/epss?cve=CVE-2025-58058
2
reference_url https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-58058
reference_id
reference_type
scores
url https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-58058
3
reference_url https://ftp.suse.com/pub/projects/security/yaml/suse-cvss-scores.yaml
reference_id
reference_type
scores
0
value 5.3
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
url https://ftp.suse.com/pub/projects/security/yaml/suse-cvss-scores.yaml
4
reference_url https://github.com/ulikunitz/xz
reference_id
reference_type
scores
0
value 5.3
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
1
value MODERATE
scoring_system generic_textual
scoring_elements
url https://github.com/ulikunitz/xz
5
reference_url https://github.com/ulikunitz/xz/commit/88ddf1d0d98d688db65de034f48960b2760d2ae2
reference_id
reference_type
scores
0
value 5.3
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
1
value MODERATE
scoring_system generic_textual
scoring_elements
url https://github.com/ulikunitz/xz/commit/88ddf1d0d98d688db65de034f48960b2760d2ae2
6
reference_url https://github.com/ulikunitz/xz/security/advisories/GHSA-jc7w-c686-c4v9
reference_id
reference_type
scores
0
value 5.3
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
1
value MODERATE
scoring_system generic_textual
scoring_elements
url https://github.com/ulikunitz/xz/security/advisories/GHSA-jc7w-c686-c4v9
7
reference_url https://nvd.nist.gov/vuln/detail/CVE-2025-58058
reference_id
reference_type
scores
0
value 5.3
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
1
value MODERATE
scoring_system generic_textual
scoring_elements
url https://nvd.nist.gov/vuln/detail/CVE-2025-58058
8
reference_url https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1112508
reference_id 1112508
reference_type
scores
url https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1112508
9
reference_url https://bugzilla.redhat.com/show_bug.cgi?id=2391585
reference_id 2391585
reference_type
scores
url https://bugzilla.redhat.com/show_bug.cgi?id=2391585
fixed_packages
0
url pkg:deb/debian/golang-github-ulikunitz-xz@0.5.15-1?distro=trixie
purl pkg:deb/debian/golang-github-ulikunitz-xz@0.5.15-1?distro=trixie
is_vulnerable false
affected_by_vulnerabilities
resource_url http://public2.vulnerablecode.io/packages/pkg:deb/debian/golang-github-ulikunitz-xz@0.5.15-1%3Fdistro=trixie
aliases CVE-2025-58058, GHSA-jc7w-c686-c4v9
risk_score 3.1
exploitability 0.5
weighted_severity 6.2
resource_url http://public2.vulnerablecode.io/vulnerabilities/VCID-aag6-jhbk-qqd6
Fixing_vulnerabilities
0
url VCID-esea-tj2b-h7ey
vulnerability_id VCID-esea-tj2b-h7ey
summary
github.com/ulikunitz/xz fixes readUvarint Denial of Service (DoS)
### Impact

xz is a compression and decompression library focusing on the xz format completely written in Go. The function readUvarint used to read the xz container format may not terminate a loop provide malicous input.

### Patches

The problem has been fixed in release v0.5.8.

### Workarounds

Limit the size of the compressed file input to a reasonable size for your use case.

### References

The standard library had recently the same issue and got the [CVE-2020-16845](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-16845) allocated.

### For more information
If you have any questions or comments about this advisory:
* Open an issue in [xz](https://github.com/ulikunitz/xz/issues).
references
0
reference_url https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2021-29482.json
reference_id
reference_type
scores
0
value 7.5
scoring_system cvssv3
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
url https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2021-29482.json
1
reference_url https://api.first.org/data/v1/epss?cve=CVE-2021-29482
reference_id
reference_type
scores
0
value 0.00433
scoring_system epss
scoring_elements 0.62773
published_at 2026-04-24T12:55:00Z
1
value 0.00433
scoring_system epss
scoring_elements 0.62679
published_at 2026-04-02T12:55:00Z
2
value 0.00433
scoring_system epss
scoring_elements 0.62712
published_at 2026-04-04T12:55:00Z
3
value 0.00433
scoring_system epss
scoring_elements 0.62676
published_at 2026-04-07T12:55:00Z
4
value 0.00433
scoring_system epss
scoring_elements 0.62728
published_at 2026-04-13T12:55:00Z
5
value 0.00433
scoring_system epss
scoring_elements 0.62744
published_at 2026-04-09T12:55:00Z
6
value 0.00433
scoring_system epss
scoring_elements 0.62762
published_at 2026-04-11T12:55:00Z
7
value 0.00433
scoring_system epss
scoring_elements 0.62752
published_at 2026-04-12T12:55:00Z
8
value 0.00433
scoring_system epss
scoring_elements 0.62769
published_at 2026-04-16T12:55:00Z
9
value 0.00433
scoring_system epss
scoring_elements 0.62777
published_at 2026-04-18T12:55:00Z
10
value 0.00433
scoring_system epss
scoring_elements 0.62758
published_at 2026-04-21T12:55:00Z
11
value 0.00433
scoring_system epss
scoring_elements 0.62621
published_at 2026-04-01T12:55:00Z
url https://api.first.org/data/v1/epss?cve=CVE-2021-29482
2
reference_url https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29482
reference_id
reference_type
scores
url https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29482
3
reference_url https://github.com/ulikunitz/xz/commit/69c6093c7b2397b923acf82cb378f55ab2652b9b
reference_id
reference_type
scores
0
value 7.5
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://github.com/ulikunitz/xz/commit/69c6093c7b2397b923acf82cb378f55ab2652b9b
4
reference_url https://github.com/ulikunitz/xz/issues/35
reference_id
reference_type
scores
0
value 7.5
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://github.com/ulikunitz/xz/issues/35
5
reference_url https://github.com/ulikunitz/xz/security/advisories/GHSA-25xm-hr59-7c27
reference_id
reference_type
scores
0
value 7.5
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://github.com/ulikunitz/xz/security/advisories/GHSA-25xm-hr59-7c27
6
reference_url https://nvd.nist.gov/vuln/detail/CVE-2021-29482
reference_id
reference_type
scores
0
value 7.5
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://nvd.nist.gov/vuln/detail/CVE-2021-29482
7
reference_url https://pkg.go.dev/vuln/GO-2020-0016
reference_id
reference_type
scores
0
value 7.5
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://pkg.go.dev/vuln/GO-2020-0016
8
reference_url https://bugzilla.redhat.com/show_bug.cgi?id=1954368
reference_id 1954368
reference_type
scores
url https://bugzilla.redhat.com/show_bug.cgi?id=1954368
9
reference_url https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988243
reference_id 988243
reference_type
scores
url https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988243
10
reference_url https://access.redhat.com/errata/RHSA-2021:2920
reference_id RHSA-2021:2920
reference_type
scores
url https://access.redhat.com/errata/RHSA-2021:2920
11
reference_url https://access.redhat.com/errata/RHSA-2022:0687
reference_id RHSA-2022:0687
reference_type
scores
url https://access.redhat.com/errata/RHSA-2022:0687
12
reference_url https://access.redhat.com/errata/RHSA-2022:1276
reference_id RHSA-2022:1276
reference_type
scores
url https://access.redhat.com/errata/RHSA-2022:1276
13
reference_url https://access.redhat.com/errata/RHSA-2022:2183
reference_id RHSA-2022:2183
reference_type
scores
url https://access.redhat.com/errata/RHSA-2022:2183
fixed_packages
0
url pkg:deb/debian/golang-github-ulikunitz-xz@0.5.6-2?distro=trixie
purl pkg:deb/debian/golang-github-ulikunitz-xz@0.5.6-2?distro=trixie
is_vulnerable true
affected_by_vulnerabilities
0
vulnerability VCID-aag6-jhbk-qqd6
resource_url http://public2.vulnerablecode.io/packages/pkg:deb/debian/golang-github-ulikunitz-xz@0.5.6-2%3Fdistro=trixie
1
url pkg:deb/debian/golang-github-ulikunitz-xz@0.5.15-1?distro=trixie
purl pkg:deb/debian/golang-github-ulikunitz-xz@0.5.15-1?distro=trixie
is_vulnerable false
affected_by_vulnerabilities
resource_url http://public2.vulnerablecode.io/packages/pkg:deb/debian/golang-github-ulikunitz-xz@0.5.15-1%3Fdistro=trixie
aliases CVE-2021-29482, GHSA-25xm-hr59-7c27
risk_score 4.0
exploitability 0.5
weighted_severity 8.0
resource_url http://public2.vulnerablecode.io/vulnerabilities/VCID-esea-tj2b-h7ey
Risk_score3.1
Resource_urlhttp://public2.vulnerablecode.io/packages/pkg:deb/debian/golang-github-ulikunitz-xz@0.5.6-2%3Fdistro=trixie