CVE-2021-35515: Commons compress Excessive Iteration Vulnerability

HIGH
Advisory Identifier: GHSA-7hfm-57qf-j43q
CVSS 7.5
CWE-834 CWE-835
Published
Advisory Summary

CVE-2021-35515 is a HIGH (CVSS 7.5) excessive iteration vulnerability (CWE-834: Excessive Iteration) affecting Commons compress libraries in the Maven ecosystem. The issue involves excessive iteration in compress. Remediation is available by upgrading affected packages to version 1.21.

CVE-2021-35515 at a Glance

CVE Identifier CVE-2021-35515
GHSA Identifier GHSA-7hfm-57qf-j43q
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-834: Excessive Iteration
Affected Product Commons compress
Package Ecosystem Maven
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-35515

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

org.apache.commons:commons-compress fixed: 1.21
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-compress</artifactId>
    <version>1.21</version>
</dependency>
Verify Direct and Transitive Dependencies

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

mvn dependency:tree -Dincludes=org.apache.commons

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2021-35515, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.commons

Analyze the terminal output to locate any version of Commons compress in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.21), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.apache.commons command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-834: Excessive Iteration, where the product performs an iteration or loop without sufficiently limiting the number of times that the loop is executed. In Commons compress, 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

When reading a specially crafted 7Z archive, the construction of the list of codecs that decompress an entry can result in an infinite loop. This could be used to mount a denial of service attack against services that use Compress' sevenz package.

CVE-2021-35515 Affected Commons compress Versions

1 component(s)
Fixed Versions:
1.21
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.commons:commons-compress
Maven
< 1.21
1.21

References

NVD — CVE-2021-35515 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-35515
Commons compress Security Information SECURITY
https://www.oracle.com/security-alerts/cpuoct2021.html
Commons compress Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html
Commons compress Security Information SECURITY
https://www.oracle.com/security-alerts/cpujan2022.html
Commons compress Security Information SECURITY
https://www.oracle.com/security-alerts/cpuapr2022.html
Commons compress Security Information SECURITY
https://security.netapp.com/advisory/ntap-20211022-0001
lists.apache.org/thread.html/rfba191... WEB
https://lists.apache.org/thread.html/rfba19167efc785ad3561e7ef29f340d65ac8f0d897aed00e0731e742@%3Cnotifications.skywalking.apache.org%3E
lists.apache.org/thread.html/rf2f4d7... WEB
https://lists.apache.org/thread.html/rf2f4d7940371a7c7c5b679f50e28fc7fcc82cd00670ced87e013ac88@%3Ccommits.druid.apache.org%3E
lists.apache.org/thread.html/rd4332b... WEB
https://lists.apache.org/thread.html/rd4332baaf6debd03d60deb7ec93bee49e5fdbe958cb6800dff7fb00e@%3Cnotifications.skywalking.apache.org%3E
lists.apache.org/thread.html/rbe91c5... WEB
https://lists.apache.org/thread.html/rbe91c512c5385181149ab087b6c909825d34299f5c491c6482a2ed57@%3Ccommits.druid.apache.org%3E
lists.apache.org/thread.html/rbaea15... WEB
https://lists.apache.org/thread.html/rbaea15ddc5a7c0c6b66660f1d6403b28595e2561bb283eade7d7cd69@%3Cannounce.apache.org%3E
lists.apache.org/thread.html/rba65ed... WEB
https://lists.apache.org/thread.html/rba65ed5ddb0586f5b12598f55ec7db3633e7b7fede60466367fbf86a@%3Cnotifications.skywalking.apache.org%3E
lists.apache.org/thread.html/rb7adf3... WEB
https://lists.apache.org/thread.html/rb7adf3e55359819e77230b4586521e5c6874ce5ed93384bdc14d6aee@%3Cnotifications.skywalking.apache.org%3E
lists.apache.org/thread.html/rb6e1fa... WEB
https://lists.apache.org/thread.html/rb6e1fa80d34e5ada45f72655d84bfd90db0ca44ef19236a49198c88c@%3Cnotifications.skywalking.apache.org%3E
lists.apache.org/thread.html/rb064d7... WEB
https://lists.apache.org/thread.html/rb064d705fdfa44b5dae4c366b369ef6597951083196321773b983e71@%3Ccommits.pulsar.apache.org%3E
lists.apache.org/thread.html/racd0c0... WEB
https://lists.apache.org/thread.html/racd0c0381c8404f298b226cd9db2eaae965b14c9c568224aa3f437ae@%3Cnotifications.skywalking.apache.org%3E
lists.apache.org/thread.html/rab2920... WEB
https://lists.apache.org/thread.html/rab292091eadd1ecc63c516e9541a7f241091cf2e652b8185a6059945@%3Ccommits.druid.apache.org%3E
lists.apache.org/thread.html/r9f54c0... WEB
https://lists.apache.org/thread.html/r9f54c0caa462267e0cc68b49f141e91432b36b23348d18c65bd0d040@%3Cnotifications.skywalking.apache.org%3E
lists.apache.org/thread.html/r67ef3c... WEB
https://lists.apache.org/thread.html/r67ef3c07fe3b8c1b02d48012149d280ad6da8e4cec253b527520fb2b@%3Cdev.poi.apache.org%3E
lists.apache.org/thread.html/r19ebfd... WEB
https://lists.apache.org/thread.html/r19ebfd71770ec0617a9ea180e321ef927b3fefb4c81ec5d1902d20ab%40%3Cuser.commons.apache.org%3E
Commons compress Security Information SECURITY
https://commons.apache.org/proper/commons-compress/security-reports.html
Commons compress Security Information SECURITY
http://www.openwall.com/lists/oss-security/2021/07/13/1

Frequently Asked Questions

What is CVE-2021-35515?
CVE-2021-35515 is a security vulnerability in Commons compress involving Excessive Iteration in Compress under CWE-834: Excessive Iteration.
Which Commons compress versions are affected?
Affected versions include releases prior to 1.21 across affected packages: org.apache.commons:commons-compress.
What version fixes CVE-2021-35515?
Upgrading to 1.21 (or the latest patched release for your respective branch) resolves the vulnerability.
Is commons-compress affected?
Yes, org.apache.commons:commons-compress is affected in releases prior to 1.21. Upgrade your dependency to 1.21 or later.
What is the CVSS score of CVE-2021-35515?
CVE-2021-35515 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-35515?
CVE-2021-35515 is classified under CWE-834: Excessive Iteration (The product performs an iteration or loop without sufficiently limiting the number of times that the loop is executed.).
How can I check Maven dependencies for CVE-2021-35515?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.commons'. 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-7hfm-57qf-j43q",
  "modified" : "2022-02-08T21:08:33Z",
  "published" : "2021-08-02T16:55:07Z",
  "aliases" : [ "CVE-2021-35515" ],
  "summary" : "Excessive Iteration in Compress",
  "details" : "When reading a specially crafted 7Z archive, the construction of the list of codecs that decompress an entry can result in an infinite loop. This could be used to mount a denial of service attack against services that use Compress' sevenz package.",
  "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" : "Maven",
      "name" : "org.apache.commons:commons-compress"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.21"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-35515"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuoct2021.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujan2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20211022-0001"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rfba19167efc785ad3561e7ef29f340d65ac8f0d897aed00e0731e742@%3Cnotifications.skywalking.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rf2f4d7940371a7c7c5b679f50e28fc7fcc82cd00670ced87e013ac88@%3Ccommits.druid.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rd4332baaf6debd03d60deb7ec93bee49e5fdbe958cb6800dff7fb00e@%3Cnotifications.skywalking.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rbe91c512c5385181149ab087b6c909825d34299f5c491c6482a2ed57@%3Ccommits.druid.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rbaea15ddc5a7c0c6b66660f1d6403b28595e2561bb283eade7d7cd69@%3Cannounce.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rba65ed5ddb0586f5b12598f55ec7db3633e7b7fede60466367fbf86a@%3Cnotifications.skywalking.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rb7adf3e55359819e77230b4586521e5c6874ce5ed93384bdc14d6aee@%3Cnotifications.skywalking.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rb6e1fa80d34e5ada45f72655d84bfd90db0ca44ef19236a49198c88c@%3Cnotifications.skywalking.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rb064d705fdfa44b5dae4c366b369ef6597951083196321773b983e71@%3Ccommits.pulsar.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/racd0c0381c8404f298b226cd9db2eaae965b14c9c568224aa3f437ae@%3Cnotifications.skywalking.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rab292091eadd1ecc63c516e9541a7f241091cf2e652b8185a6059945@%3Ccommits.druid.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r9f54c0caa462267e0cc68b49f141e91432b36b23348d18c65bd0d040@%3Cnotifications.skywalking.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r67ef3c07fe3b8c1b02d48012149d280ad6da8e4cec253b527520fb2b@%3Cdev.poi.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r19ebfd71770ec0617a9ea180e321ef927b3fefb4c81ec5d1902d20ab%40%3Cuser.commons.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://commons.apache.org/proper/commons-compress/security-reports.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2021/07/13/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-834", "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-07-14T17:35:41Z",
    "nvd_published_at" : "2021-07-13T08:15:00Z"
  }
}