CVE-2020-16845: Infinite loop in xz

github.com/ulikunitz/xz Updated 02 Oct 2025

Summary

16/12/2021
Yes i
High
7.5

CVE-2020-16845: Infinite loop in xz. Affects github.com/ulikunitz/xz versions < 0.5.8. Fixed in 0.5.8. How to fix ↓

Also tracked for

The same CVE-2020-16845 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The package under scrutiny is 'github.com/ulikunitz/xz', which is a Go package for working with the xz compression format. It provides functions for compressing and decompressing data using the xz algorithm. The vulnerability in this package can lead to an infinite read loop in the encoding/binary module when handling invalid inputs.

Vulnerability Detail

The vulnerability (CVE-2020-16845) in 'github.com/ulikunitz/xz' affects versions before 0.5.8. It specifically impacts the ReadUvarint and ReadVarint functions in the encoding/binary module. When provided with invalid inputs, these functions can enter an infinite loop, causing a denial-of-service condition. An attacker could exploit this vulnerability by sending specially crafted data to a vulnerable application, leading to excessive resource consumption and potentially crashing the application.

How To Fix

Latest published version: v0.5.17 as of 22 Oct 2026

go get github.com/ulikunitz/xz@v0.5.17

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.5.8

This is the first release that contains the fix.

go get github.com/ulikunitz/xz@v0.5.8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is essential to update the package to the fixed version as mentioned above.

Conclusion

In conclusion, the 'github.com/ulikunitz/xz' package has a vulnerability (CVE-2020-16845) that can result in an infinite read loop when handling invalid inputs. This can lead to a denial-of-service condition in affected applications. To mitigate this vulnerability, it is crucial to update the package to version 0.5.8 or later. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for github.com/ulikunitz/xz →

Share this vulnerability

FAQ

This vulnerability can lead to a denial-of-service condition in applications that use the 'github.com/ulikunitz/xz' package. An attacker can exploit this vulnerability to consume excessive resources and potentially crash the application.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply provide your Gopkg.lock file, and Vulert will analyze it for open-source vulnerabilities in real-time.

No, only versions before 0.5.8 are affected by this vulnerability. It is crucial to update to version 0.5.8 or later to mitigate the risk.

There is no known public exploit for this vulnerability at the time of writing. However, it is still recommended to update the package to the fixed version to prevent any potential exploitation.

It is not recommended to manually patch the package, as it may introduce errors or inconsistencies. It is best to update to the fixed version provided by the package maintainers.

Related vulnerabilities

Recent vulnerabilities recorded for github.com/ulikunitz/xz.

How To Fix

Latest published version: v0.5.17 as of 22 Oct 2026

go get github.com/ulikunitz/xz@v0.5.17

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.5.8

This is the first release that contains the fix.

go get github.com/ulikunitz/xz@v0.5.8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback