CVE-2020-16845: Infinite loop in xz
Summary
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
- golang · Bitnami
- stdlib · Go
- golang-1.15 · Debian:11
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.
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.
No signup required · Results in about 60 seconds
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 →
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.
References
Related vulnerabilities
Recent vulnerabilities recorded for github.com/ulikunitz/xz.