CVE-2021-37137: Netty codec SnappyFrameDecoder Doesn't Restrict Chunk Length Vulnerability

HIGH
Advisory Identifier: GHSA-9vjp-v76f-g363
CVSS 7.5
CWE-400
Published
Advisory Summary

CVE-2021-37137 is a HIGH (CVSS 7.5) snappyframedecoder doesn't restrict chunk length vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Netty codec libraries in the Maven ecosystem. The issue involves snappyframedecoder doesn't restrict chunk length any may buffer skippable chunks in an unnecessary way. Remediation is available by upgrading affected packages to version 4.1.68.Final.

CVE-2021-37137 at a Glance

CVE Identifier CVE-2021-37137
GHSA Identifier GHSA-9vjp-v76f-g363
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Netty codec
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-37137

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

io.netty:netty-codec fixed: 4.1.68.Final
<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-codec</artifactId>
    <version>4.1.68.Final</version>
</dependency>
org.jboss.netty:netty fixed: Latest secure release
<dependency>
    <groupId>org.jboss.netty</groupId>
    <artifactId>netty</artifactId>
    <version>Latest secure release</version>
</dependency>
io.netty:netty fixed: Latest secure release
<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty</artifactId>
    <version>Latest secure release</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=io.netty

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=io.netty

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

Note: The mvn dependency:tree -Dincludes=io.netty 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Netty codec, 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 The Snappy frame decoder function doesn't restrict the chunk length which may lead to excessive memory usage. Beside this it also may buffer reserved skippable chunks until the whole chunk was received which may lead to excessive memory usage as well. This vulnerability can be triggered by supplying malicious input that decompresses to a very big size (via a network stream or a file) or by sending a huge skippable chunk. ### Impact All users of SnappyFrameDecoder are affected and so the application may be in risk for a DoS attach due excessive memory usage. ### References https://github.com/netty/netty/blob/netty-4.1.67.Final/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L79 https://github.com/netty/netty/blob/netty-4.1.67.Final/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L171 https://github.com/netty/netty/blob/netty-4.1.67.Final/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L185

CVE-2021-37137 Affected Netty codec Versions

3 component(s)
Fixed Versions:
4.1.68.Final
Product / Package Ecosystem Affected Versions Fixed Version
io.netty:netty-codec
Maven
≥ 4.0.0
< 4.1.68.Final
4.1.68.Final
org.jboss.netty:netty
Maven
io.netty:netty
Maven

References

GitHub Advisory / Wiki ADVISORY
https://github.com/netty/netty/security/advisories/GHSA-9vjp-v76f-g363
NVD — CVE-2021-37137 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-37137
Security Fix Commit FIX COMMIT
https://github.com/netty/netty/commit/6da4956b31023ae967451e1d94ff51a746a9194f
Netty codec Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html
Netty codec Security Information SECURITY
https://www.oracle.com/security-alerts/cpujan2022.html
Netty codec Security Information SECURITY
https://www.oracle.com/security-alerts/cpuapr2022.html
Netty codec Security Information SECURITY
https://www.debian.org/security/2023/dsa-5316
Netty codec Security Information SECURITY
https://security.netapp.com/advisory/ntap-20220210-0012
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2023/01/msg00008.html
lists.apache.org/thread.html/rfb2bf8... WEB
https://lists.apache.org/thread.html/rfb2bf8597e53364ccab212fbcbb2a4e9f0a9e1429b1dc08023c6868e@%3Cdev.tinkerpop.apache.org%3E
lists.apache.org/thread.html/rd262f5... WEB
https://lists.apache.org/thread.html/rd262f59b1586a108e320e5c966feeafbb1b8cdc96965debc7cc10b16@%3Ccommits.druid.apache.org%3E
lists.apache.org/thread.html/r75490c... WEB
https://lists.apache.org/thread.html/r75490c61c2cb7b6ae2c81238fd52ae13636c60435abcd732d41531a0@%3Ccommits.druid.apache.org%3E
lists.apache.org/thread.html/r5e05eb... WEB
https://lists.apache.org/thread.html/r5e05eba32476c580412f9fbdfc9b8782d5b40558018ac4ac07192a04@%3Ccommits.druid.apache.org%3E
lists.apache.org/thread.html/r5406ea... WEB
https://lists.apache.org/thread.html/r5406eaf3b07577d233b9f07cfc8f26e28369e6bab5edfcab41f28abb@%3Ccommits.druid.apache.org%3E
lists.apache.org/thread.html/r06a145... WEB
https://lists.apache.org/thread.html/r06a145c9bd41a7344da242cef07977b24abe3349161ede948e30913d@%3Ccommits.druid.apache.org%3E
Netty codec Source Repository REPOSITORY
https://github.com/netty/netty/blob/4.1/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L79
Netty codec Source Repository REPOSITORY
https://github.com/netty/netty/blob/4.1/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L185
Netty codec Source Repository REPOSITORY
https://github.com/netty/netty/blob/4.1/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L171
Netty codec Source Repository REPOSITORY
https://github.com/netty/netty

Frequently Asked Questions

What is CVE-2021-37137?
CVE-2021-37137 is a security vulnerability in Netty codec involving SnappyFrameDecoder doesn't restrict chunk length any may buffer skippable chunks in an unnecessary way under CWE-400: Uncontrolled Resource Consumption.
Which Netty codec versions are affected?
Affected versions include releases prior to 4.1.68.Final across affected packages: io.netty:netty-codec, org.jboss.netty:netty, io.netty:netty.
What version fixes CVE-2021-37137?
Upgrading to 4.1.68.Final (or the latest patched release for your respective branch) resolves the vulnerability.
Is netty-codec affected?
Yes, io.netty:netty-codec is affected in releases prior to 4.1.68.Final. Upgrade your dependency to 4.1.68.Final or later.
Is netty affected?
Yes, org.jboss.netty:netty is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2021-37137?
CVE-2021-37137 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-37137?
CVE-2021-37137 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check Maven dependencies for CVE-2021-37137?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=io.netty'. 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-9vjp-v76f-g363",
  "modified" : "2022-02-08T20:35:49Z",
  "published" : "2021-09-09T17:11:31Z",
  "aliases" : [ "CVE-2021-37137" ],
  "summary" : " SnappyFrameDecoder doesn't restrict chunk length any may buffer skippable chunks in an unnecessary way",
  "details" : "### Impact\nThe Snappy frame decoder function doesn't restrict the chunk length which may lead to excessive memory usage. Beside this it also may buffer reserved skippable chunks until the whole chunk was received which may lead to excessive memory usage as well.\n\nThis vulnerability can be triggered by supplying malicious input that decompresses to a very big size (via a network stream or a file) or by sending a huge skippable chunk.\n\n### Impact\n\nAll users of SnappyFrameDecoder are affected and so the application may be in risk for a DoS attach due excessive memory usage.\n\n### References\nhttps://github.com/netty/netty/blob/netty-4.1.67.Final/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L79\nhttps://github.com/netty/netty/blob/netty-4.1.67.Final/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L171\nhttps://github.com/netty/netty/blob/netty-4.1.67.Final/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L185",
  "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" : "io.netty:netty-codec"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.1.68.Final"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.jboss.netty:netty"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 4.0.0"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "io.netty:netty"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 4.0.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/netty/netty/security/advisories/GHSA-9vjp-v76f-g363"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-37137"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/netty/netty/commit/6da4956b31023ae967451e1d94ff51a746a9194f"
  }, {
    "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://www.debian.org/security/2023/dsa-5316"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220210-0012"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/01/msg00008.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rfb2bf8597e53364ccab212fbcbb2a4e9f0a9e1429b1dc08023c6868e@%3Cdev.tinkerpop.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rd262f59b1586a108e320e5c966feeafbb1b8cdc96965debc7cc10b16@%3Ccommits.druid.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r75490c61c2cb7b6ae2c81238fd52ae13636c60435abcd732d41531a0@%3Ccommits.druid.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r5e05eba32476c580412f9fbdfc9b8782d5b40558018ac4ac07192a04@%3Ccommits.druid.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r5406eaf3b07577d233b9f07cfc8f26e28369e6bab5edfcab41f28abb@%3Ccommits.druid.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r06a145c9bd41a7344da242cef07977b24abe3349161ede948e30913d@%3Ccommits.druid.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/netty/netty/blob/4.1/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L79"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/netty/netty/blob/4.1/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L185"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/netty/netty/blob/4.1/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L171"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/netty/netty"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-09-09T14:44:10Z",
    "nvd_published_at" : "2021-10-19T15:15:00Z"
  }
}