Skip to main content

CVE-2022-31018: CWE-400: Uncontrolled Resource Consumption in playframework playframework

Medium
Published: Thu Jun 02 2022 (06/02/2022, 16:45:13 UTC)
Source: CVE
Vendor/Project: playframework
Product: playframework

Description

Play Framework is a web framework for Java and Scala. A denial of service vulnerability has been discovered in verions 2.8.3 through 2.8.15 of 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. 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. As a workaround, 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.

AI-Powered Analysis

AILast updated: 06/23/2025, 07:36:25 UTC

Technical Analysis

CVE-2022-31018 is a denial of service (DoS) vulnerability affecting the Play Framework, a popular web framework for Java and Scala applications. Specifically, versions 2.8.3 through 2.8.15 of the Play Framework's forms library are vulnerable. The issue arises when the form binding methods, namely `Form#bindFromRequest` and `Form#bind`, process JSON request bodies containing deeply nested JSON objects or arrays. The vulnerability is due to uncontrolled resource consumption during the parsing and binding of such JSON data. When a deeply nested JSON structure is submitted, the form binding implementation can consume excessive heap memory, leading to an `OutOfMemoryError`. If the application is running with the default Akka dispatcher and the configuration `akka.jvm-exit-on-fatal-error` is enabled (which it is by default), this error can cause the entire application process to crash. The vulnerability affects both Scala and Java APIs and is triggered when using body parsers that produce `AnyContent` or `JsValue` in Scala or `JsonNode` in Java, including Play's default body parser. The root cause is the lack of a limit on the depth of JSON objects parsed during form binding, allowing attackers to craft maliciously deep JSON payloads to exhaust memory resources. This vulnerability was patched in Play Framework version 2.8.16 by introducing a configurable global limit on JSON object depth during parsing. As a temporary mitigation, applications that do not require parsing JSON request bodies can switch to more restrictive body parsers that only accept expected content types, thereby avoiding the vulnerable JSON parsing code path.

Potential Impact

For European organizations, this vulnerability poses a risk primarily to web applications built using the affected versions of the Play Framework. Successful exploitation can lead to denial of service by crashing the application process, resulting in service outages and potential disruption of business operations. This can affect customer-facing services, internal applications, or APIs relying on Play Framework forms for JSON data binding. The impact on confidentiality and integrity is minimal since the vulnerability does not allow code execution or data leakage directly; however, availability is significantly impacted. Organizations in sectors with high reliance on web services—such as finance, e-commerce, government, and telecommunications—may experience operational disruptions. Additionally, if exploited in critical infrastructure or public services, the resulting downtime could have broader societal implications. Given that the vulnerability can be triggered remotely by submitting crafted JSON payloads, it can be exploited without authentication or user interaction, increasing the risk profile. The absence of known exploits in the wild reduces immediate threat but does not eliminate the risk, especially as attackers may develop exploits over time.

Mitigation Recommendations

1. Upgrade to Play Framework version 2.8.16 or later, which includes the patch that enforces a configurable global limit on JSON object depth during parsing. 2. If immediate upgrade is not feasible, configure the application to use body parsers that restrict accepted content types, avoiding the default JSON parsers that are vulnerable. For example, switch from the default `AnyContent` or `JsValue` parsers to parsers that only accept specific, non-JSON content types if JSON input is not required. 3. Implement input validation and size limits on incoming JSON payloads at the application or web server level to detect and block excessively nested or large JSON requests. 4. Monitor application logs and metrics for signs of increased memory consumption or frequent `OutOfMemoryError` exceptions, which may indicate attempted exploitation. 5. Employ web application firewalls (WAFs) with rules to detect and block suspiciously deep or complex JSON payloads. 6. Conduct security testing, including fuzzing of JSON inputs, to identify and remediate similar resource exhaustion issues in custom code. 7. Educate development teams about safe JSON parsing practices and the risks of uncontrolled resource consumption.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-05-18T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9843c4522896dcbf30be

Added to database: 5/21/2025, 9:09:23 AM

Last enriched: 6/23/2025, 7:36:25 AM

Last updated: 7/29/2025, 1:10:36 AM

Views: 14

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats