CVE-2021-29482: Github.com/ulikunitz/xz Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-25xm-hr59-7c27
CVSS 7.5
CWE-835
Published
Advisory Summary

CVE-2021-29482 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Github.com/ulikunitz/xz libraries in the Go ecosystem. The issue involves github.com/ulikunitz/xz fixes readuvarint denial of service (dos). Remediation is available by upgrading affected packages to version 0.5.8.

CVE-2021-29482 at a Glance

CVE Identifier CVE-2021-29482
GHSA Identifier GHSA-25xm-hr59-7c27
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product Github.com/ulikunitz/xz
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2021-29482

To remediate this vulnerability, upgrade all affected Github.com/ulikunitz/xz dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/ulikunitz/xz fixed: 0.5.8
Upgrade github.com/ulikunitz/xz to 0.5.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/ulikunitz/xz

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-29482, inspect your project dependencies for Github.com/ulikunitz/xz:

inspect dependencies for github.com/ulikunitz/xz

Analyze the terminal output to locate any version of Github.com/ulikunitz/xz in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.5.8), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In Github.com/ulikunitz/xz, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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

CVE-2021-29482 Affected Github.com/ulikunitz/xz Versions

1 component(s)
Fixed Versions:
0.5.8
Product / Package Ecosystem Affected Versions Fixed Version
github.com/ulikunitz/xz
Go
< 0.5.8
0.5.8

References

Frequently Asked Questions

What is CVE-2021-29482?
CVE-2021-29482 is a security vulnerability in Github.com/ulikunitz/xz involving github.com/ulikunitz/xz fixes readUvarint Denial of Service (DoS) under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Github.com/ulikunitz/xz versions are affected?
Affected versions include releases prior to 0.5.8 across affected packages: github.com/ulikunitz/xz.
What version fixes CVE-2021-29482?
Upgrading to 0.5.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/ulikunitz/xz affected?
Yes, github.com/ulikunitz/xz is affected in releases prior to 0.5.8. Upgrade your dependency to 0.5.8 or later.
What is the CVSS score of CVE-2021-29482?
CVE-2021-29482 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-29482?
CVE-2021-29482 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check Go dependencies for CVE-2021-29482?
Run the dependency tree command: 'inspect dependencies for github.com/ulikunitz/xz'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-25xm-hr59-7c27",
  "modified" : "2024-05-31T17:45:58Z",
  "published" : "2021-05-25T18:39:37Z",
  "aliases" : [ "CVE-2021-29482" ],
  "summary" : "github.com/ulikunitz/xz fixes readUvarint Denial of Service (DoS)",
  "details" : "### Impact\n\nxz 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.\n\n### Patches\n\nThe problem has been fixed in release v0.5.8.\n\n### Workarounds\n\nLimit the size of the compressed file input to a reasonable size for your use case.\n\n### References\n\nThe 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.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [xz](https://github.com/ulikunitz/xz/issues).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/ulikunitz/xz"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.5.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ulikunitz/xz/security/advisories/GHSA-25xm-hr59-7c27"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29482"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ulikunitz/xz/issues/35"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ulikunitz/xz/commit/69c6093c7b2397b923acf82cb378f55ab2652b9b"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2020-0016"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-24T17:52:22Z",
    "nvd_published_at" : "2021-04-28T19:15:00Z"
  }
}