CVE-2022-3171: Protobuf java Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-h4h5-3hr4-j3g2
CVSS 5.7
CWE-20
Published
Advisory Summary

CVE-2022-3171 is a MODERATE (CVSS 5.7) denial of service vulnerability (CWE-20: Improper Input Validation) affecting Protobuf java libraries in the Maven ecosystem. The issue involves protobuf-java has a potential denial of service issue. Remediation is available by upgrading affected packages to version 3.21.7, 3.20.3, 3.19.6, 3.16.3.

CVE-2022-3171 at a Glance

CVE Identifier CVE-2022-3171
GHSA Identifier GHSA-h4h5-3hr4-j3g2
Severity MODERATE
CVSS v3.1 Base Score 5.7
CWE Classification CWE-20: Improper Input Validation
Affected Product Protobuf java
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 5.7

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

Attack Vector Adjacent (AV:A)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
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-2022-3171

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

com.google.protobuf:protobuf-java fixed: 3.21.7
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-java</artifactId>
    <version>3.21.7</version>
</dependency>
com.google.protobuf:protobuf-kotlin fixed: 3.21.7
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-kotlin</artifactId>
    <version>3.21.7</version>
</dependency>
google-protobuf fixed: 3.21.7
Upgrade google-protobuf to 3.21.7
com.google.protobuf:protobuf-javalite fixed: 3.21.7
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-javalite</artifactId>
    <version>3.21.7</version>
</dependency>
com.google.protobuf:protobuf-kotlin-lite fixed: 3.21.7
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-kotlin-lite</artifactId>
    <version>3.21.7</version>
</dependency>
com.google.protobuf:protobuf-java fixed: 3.20.3
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-java</artifactId>
    <version>3.20.3</version>
</dependency>
com.google.protobuf:protobuf-java fixed: 3.19.6
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-java</artifactId>
    <version>3.19.6</version>
</dependency>
com.google.protobuf:protobuf-java fixed: 3.16.3
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-java</artifactId>
    <version>3.16.3</version>
</dependency>
com.google.protobuf:protobuf-kotlin fixed: 3.20.3
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-kotlin</artifactId>
    <version>3.20.3</version>
</dependency>
com.google.protobuf:protobuf-kotlin fixed: 3.19.6
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-kotlin</artifactId>
    <version>3.19.6</version>
</dependency>
com.google.protobuf:protobuf-kotlin fixed: 3.16.3
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-kotlin</artifactId>
    <version>3.16.3</version>
</dependency>
google-protobuf fixed: 3.20.3
Upgrade google-protobuf to 3.20.3
google-protobuf fixed: 3.19.6
Upgrade google-protobuf to 3.19.6
google-protobuf fixed: 3.16.3
Upgrade google-protobuf to 3.16.3
com.google.protobuf:protobuf-javalite fixed: 3.20.3
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-javalite</artifactId>
    <version>3.20.3</version>
</dependency>
com.google.protobuf:protobuf-javalite fixed: 3.19.6
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-javalite</artifactId>
    <version>3.19.6</version>
</dependency>
com.google.protobuf:protobuf-javalite fixed: 3.16.3
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-javalite</artifactId>
    <version>3.16.3</version>
</dependency>
com.google.protobuf:protobuf-kotlin-lite fixed: 3.20.3
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-kotlin-lite</artifactId>
    <version>3.20.3</version>
</dependency>
com.google.protobuf:protobuf-kotlin-lite fixed: 3.19.6
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-kotlin-lite</artifactId>
    <version>3.19.6</version>
</dependency>
com.google.protobuf:protobuf-kotlin-lite fixed: 3.16.3
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-kotlin-lite</artifactId>
    <version>3.16.3</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=com.google.protobuf

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=com.google.protobuf

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

Note: The mvn dependency:tree -Dincludes=com.google.protobuf 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Protobuf java, 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

## Summary A potential Denial of Service issue in `protobuf-java` core and lite was discovered in the parsing procedure for binary and text format data. Input streams containing multiple instances of non-repeated [embedded messages](http://developers.google.com/protocol-buffers/docs/encoding#embedded) with repeated or unknown fields causes objects to be converted back-n-forth between mutable and immutable forms, resulting in potentially long garbage collection pauses. Reporter: [OSS Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=48771) Affected versions: This issue affects both the Java full and lite Protobuf runtimes, as well as Protobuf for Kotlin and JRuby, which themselves use the Java Protobuf runtime. ## Severity [CVE-2022-3171](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-3171) Medium - CVSS Score: 5.7 (NOTE: there may be a delay in publication) ## Remediation and Mitigation Please update to the latest available versions of the following packages: protobuf-java (3.21.7, 3.20.3, 3.19.6, 3.16.3) protobuf-javalite (3.21.7, 3.20.3, 3.19.6, 3.16.3) protobuf-kotlin (3.21.7, 3.20.3, 3.19.6, 3.16.3) protobuf-kotlin-lite (3.21.7, 3.20.3, 3.19.6, 3.16.3) google-protobuf [JRuby gem only] (3.21.7, 3.20.3, 3.19.6)

CVE-2022-3171 Affected Protobuf java Versions

20 component(s)
Fixed Versions:
3.21.73.20.33.19.63.16.3
Product / Package Ecosystem Affected Versions Fixed Version
com.google.protobuf:protobuf-java
Maven
≥ 3.21.0-rc-1
< 3.21.7
3.21.7
com.google.protobuf:protobuf-kotlin
Maven
≥ 3.21.0-rc-1
< 3.21.7
3.21.7
google-protobuf
RubyGems
≥ 3.21.0.rc.1
< 3.21.7
3.21.7
com.google.protobuf:protobuf-javalite
Maven
≥ 3.21.0-rc-1
< 3.21.7
3.21.7
com.google.protobuf:protobuf-kotlin-lite
Maven
≥ 3.21.0-rc-1
< 3.21.7
3.21.7
com.google.protobuf:protobuf-java
Maven
≥ 3.20.0-rc-1
< 3.20.3
3.20.3
com.google.protobuf:protobuf-java
Maven
≥ 3.17.0-rc-1
< 3.19.6
3.19.6
com.google.protobuf:protobuf-java
Maven
< 3.16.3
3.16.3
com.google.protobuf:protobuf-kotlin
Maven
≥ 3.20.0-rc-1
< 3.20.3
3.20.3
com.google.protobuf:protobuf-kotlin
Maven
≥ 3.17.0-rc-1
< 3.19.6
3.19.6
com.google.protobuf:protobuf-kotlin
Maven
< 3.16.3
3.16.3
google-protobuf
RubyGems
≥ 3.20.0.rc.1
< 3.20.3
3.20.3
google-protobuf
RubyGems
≥ 3.17.0.rc.1
< 3.19.6
3.19.6
google-protobuf
RubyGems
< 3.16.3
3.16.3
com.google.protobuf:protobuf-javalite
Maven
≥ 3.20.0-rc-1
< 3.20.3
3.20.3
com.google.protobuf:protobuf-javalite
Maven
≥ 3.17.0-rc-1
< 3.19.6
3.19.6
com.google.protobuf:protobuf-javalite
Maven
< 3.16.3
3.16.3
com.google.protobuf:protobuf-kotlin-lite
Maven
≥ 3.20.0-rc-1
< 3.20.3
3.20.3
com.google.protobuf:protobuf-kotlin-lite
Maven
≥ 3.17.0-rc-1
< 3.19.6
3.19.6
com.google.protobuf:protobuf-kotlin-lite
Maven
< 3.16.3
3.16.3

References

Frequently Asked Questions

What is CVE-2022-3171?
CVE-2022-3171 is a security vulnerability in Protobuf java involving protobuf-java has a potential Denial of Service issue under CWE-20: Improper Input Validation.
Which Protobuf java versions are affected?
Affected versions include releases prior to 3.21.7, 3.20.3, 3.19.6, 3.16.3 across affected packages: com.google.protobuf:protobuf-java, com.google.protobuf:protobuf-kotlin, google-protobuf, com.google.protobuf:protobuf-javalite, com.google.protobuf:protobuf-kotlin-lite.
What version fixes CVE-2022-3171?
Upgrading to 3.21.7, 3.20.3, 3.19.6, 3.16.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is protobuf-java affected?
Yes, com.google.protobuf:protobuf-java is affected in releases prior to 3.21.7, 3.20.3, 3.19.6, 3.16.3. Upgrade your dependency to 3.21.7, 3.20.3, 3.19.6, 3.16.3 or later.
Is protobuf-kotlin affected?
Yes, com.google.protobuf:protobuf-kotlin is affected in releases prior to 3.21.7, 3.20.3, 3.19.6, 3.16.3. Upgrade your dependency to 3.21.7, 3.20.3, 3.19.6, 3.16.3 or later.
What is the CVSS score of CVE-2022-3171?
CVE-2022-3171 has a CVSS v3.1 base score of 5.7 (MODERATE) with vector string CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-3171?
CVE-2022-3171 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Maven dependencies for CVE-2022-3171?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.google.protobuf'. 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-h4h5-3hr4-j3g2",
  "modified" : "2022-10-04T22:17:15Z",
  "published" : "2022-10-04T22:17:15Z",
  "aliases" : [ "CVE-2022-3171" ],
  "summary" : "protobuf-java has a potential Denial of Service issue",
  "details" : "## Summary\nA potential Denial of Service issue in `protobuf-java` core and lite was discovered in the parsing procedure for binary and text format data. Input streams containing multiple instances of non-repeated [embedded messages](http://developers.google.com/protocol-buffers/docs/encoding#embedded) with repeated or unknown fields causes objects to be converted back-n-forth between mutable and immutable forms, resulting in potentially long garbage collection pauses. \n\nReporter: [OSS Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=48771)\n\nAffected versions: This issue affects both the Java full and lite Protobuf runtimes, as well as Protobuf for Kotlin and JRuby, which themselves use the Java Protobuf runtime.\n\n## Severity\n\n[CVE-2022-3171](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-3171) Medium - CVSS Score: 5.7 (NOTE: there may be a delay in publication)\n\n## Remediation and Mitigation\n\nPlease update to the latest available versions of the following packages:\n\nprotobuf-java (3.21.7, 3.20.3, 3.19.6, 3.16.3)\nprotobuf-javalite (3.21.7, 3.20.3, 3.19.6, 3.16.3)\nprotobuf-kotlin (3.21.7, 3.20.3, 3.19.6, 3.16.3)\nprotobuf-kotlin-lite (3.21.7, 3.20.3, 3.19.6, 3.16.3)\ngoogle-protobuf [JRuby gem only] (3.21.7, 3.20.3, 3.19.6)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-java"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.21.0-rc-1"
      }, {
        "fixed" : "3.21.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-kotlin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.21.0-rc-1"
      }, {
        "fixed" : "3.21.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "google-protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.21.0.rc.1"
      }, {
        "fixed" : "3.21.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-javalite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.21.0-rc-1"
      }, {
        "fixed" : "3.21.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-kotlin-lite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.21.0-rc-1"
      }, {
        "fixed" : "3.21.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-java"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.20.0-rc-1"
      }, {
        "fixed" : "3.20.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-java"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.17.0-rc-1"
      }, {
        "fixed" : "3.19.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-java"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.16.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-kotlin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.20.0-rc-1"
      }, {
        "fixed" : "3.20.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-kotlin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.17.0-rc-1"
      }, {
        "fixed" : "3.19.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-kotlin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.16.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "google-protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.20.0.rc.1"
      }, {
        "fixed" : "3.20.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "google-protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.17.0.rc.1"
      }, {
        "fixed" : "3.19.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "google-protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.16.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-javalite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.20.0-rc-1"
      }, {
        "fixed" : "3.20.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-javalite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.17.0-rc-1"
      }, {
        "fixed" : "3.19.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-javalite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.16.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-kotlin-lite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.20.0-rc-1"
      }, {
        "fixed" : "3.20.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-kotlin-lite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.17.0-rc-1"
      }, {
        "fixed" : "3.19.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.google.protobuf:protobuf-kotlin-lite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.16.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-h4h5-3hr4-j3g2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-3171"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=48771"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/protocolbuffers/protobuf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/releases/tag/v21.7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/releases/tag/v3.16.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/releases/tag/v3.19.6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/google-protobuf/CVE-2022-3171.yml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/CBAUKJQL6O4TIWYBENORSY5P43TVB4M3"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MPCGUT3T5L6C3IDWUPSUO22QDCGQKTOP"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202301-09"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-04T22:17:15Z",
    "nvd_published_at" : "2022-10-12T23:15:00Z"
  }
}