CVE-2022-31018: Play 2.13 Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-v8x6-59g4-5g3w
CVSS 7.5
CWE-400
Published
Advisory Summary

CVE-2022-31018 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Play 2.13 libraries in the Maven ecosystem. The issue involves denial of service binding form from json in play framework. Remediation is available by upgrading affected packages to version 2.8.16.

CVE-2022-31018 at a Glance

CVE Identifier CVE-2022-31018
GHSA Identifier GHSA-v8x6-59g4-5g3w
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Play 2.13
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-2022-31018

To remediate this vulnerability, upgrade all affected Play 2.13 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.typesafe.play:play_2.13 fixed: 2.8.16
<dependency>
    <groupId>com.typesafe.play</groupId>
    <artifactId>play_2.13</artifactId>
    <version>2.8.16</version>
</dependency>
com.typesafe.play:play_2.12 fixed: 2.8.16
<dependency>
    <groupId>com.typesafe.play</groupId>
    <artifactId>play_2.12</artifactId>
    <version>2.8.16</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.typesafe.play

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=com.typesafe.play

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

Note: The mvn dependency:tree -Dincludes=com.typesafe.play 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 Play 2.13, 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 A denial-of-service vulnerability has been discovered in Play's forms library, in both the Scala and Java APIs. This can occur when using either the `Form#bindFromRequest` method on a JSON request body or the `Form#bind` method directly on a JSON value. If the JSON data being bound to the form contains a deeply-nested JSON object or array, the form binding implementation may consume all available heap space and cause an `OutOfMemoryError`. If executing on the default dispatcher and `akka.jvm-exit-on-fatal-error` is enabled—as it is by default—then this can crash the application process. `Form.bindFromRequest` is vulnerable when using any body parser that produces a type of `AnyContent` or `JsValue` in Scala, or one that can produce a `JsonNode` in Java. This includes Play's default body parser. ### Patches This vulnerability been patched in version 2.8.16. There is now a global limit on the depth of a JSON object that can be parsed, which can be configured by the user if necessary. ### Workarounds Applications that do not need to parse a request body of type `application/json` can switch from the default body parser to another body parser that supports only the specific type of body they expect; for example, the `formUrlEncoded` body parser can be used if the Play action only needs to accept `application/x-www-form-urlencoded`.

CVE-2022-31018 Affected Play 2.13 Versions

2 component(s)
Fixed Versions:
2.8.16
Product / Package Ecosystem Affected Versions Fixed Version
com.typesafe.play:play_2.13
Maven
≥ 2.8.3
< 2.8.16
2.8.16
com.typesafe.play:play_2.12
Maven
≥ 2.8.3
< 2.8.16
2.8.16

References

Frequently Asked Questions

What is CVE-2022-31018?
CVE-2022-31018 is a security vulnerability in Play 2.13 involving Denial of service binding form from JSON in Play Framework under CWE-400: Uncontrolled Resource Consumption.
Which Play 2.13 versions are affected?
Affected versions include releases prior to 2.8.16 across affected packages: com.typesafe.play:play_2.13, com.typesafe.play:play_2.12.
What version fixes CVE-2022-31018?
Upgrading to 2.8.16 (or the latest patched release for your respective branch) resolves the vulnerability.
Is play_2.13 affected?
Yes, com.typesafe.play:play_2.13 is affected in releases prior to 2.8.16. Upgrade your dependency to 2.8.16 or later.
Is play_2.12 affected?
Yes, com.typesafe.play:play_2.12 is affected in releases prior to 2.8.16. Upgrade your dependency to 2.8.16 or later.
What is the CVSS score of CVE-2022-31018?
CVE-2022-31018 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-2022-31018?
CVE-2022-31018 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-2022-31018?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.typesafe.play'. 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-v8x6-59g4-5g3w",
  "modified" : "2022-06-14T20:00:10Z",
  "published" : "2022-06-03T22:18:58Z",
  "aliases" : [ "CVE-2022-31018" ],
  "summary" : "Denial of service binding form from JSON in Play Framework",
  "details" : "### Impact\n\nA denial-of-service vulnerability has been discovered in Play's forms library, in both the Scala and Java APIs. This can occur when using either the `Form#bindFromRequest` method on a JSON request body or the `Form#bind` method directly on a JSON value. If the JSON data being bound to the form contains a deeply-nested JSON object or array, the form binding implementation may consume all available heap space and cause an `OutOfMemoryError`. If executing on the default dispatcher and `akka.jvm-exit-on-fatal-error` is enabled—as it is by default—then this can crash the application process.\n\n`Form.bindFromRequest` is vulnerable when using any body parser that produces a type of `AnyContent` or `JsValue` in Scala, or one that can produce a `JsonNode` in Java. This includes Play's default body parser.\n\n### Patches\n\nThis vulnerability been patched in version 2.8.16. There is now a global limit on the depth of a JSON object that can be parsed, which can be configured by the user if necessary.\n\n### Workarounds\n\nApplications that do not need to parse a request body of type `application/json` can switch from the default body parser to another body parser that supports only the specific type of body they expect; for example, the `formUrlEncoded` body parser can be used if the Play action only needs to accept `application/x-www-form-urlencoded`.\n\n",
  "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" : "com.typesafe.play:play_2.13"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.3"
      }, {
        "fixed" : "2.8.16"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.typesafe.play:play_2.12"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.3"
      }, {
        "fixed" : "2.8.16"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/playframework/playframework/security/advisories/GHSA-v8x6-59g4-5g3w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31018"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/playframework/playframework/pull/11301"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/playframework/playframework"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/playframework/playframework/releases/tag/2.8.16"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-03T22:18:58Z",
    "nvd_published_at" : "2022-06-02T17:15:00Z"
  }
}