CVE-2022-31018
JSON

7.5high

Denial of service binding form from JSON in Play Framework

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
1.65% (higher than 77% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-v8x6-59g4-5g3w

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.

Affected

Product or packageVersionsReported by
playframework playframework>= 2.8.3, < 2.8.16CVE List
com.typesafe.play:play_2.13 (Maven)from 2.8.3 before 2.8.16GitHub Advisory Database
com.typesafe.play:play_2.12 (Maven)from 2.8.3 before 2.8.16GitHub Advisory Database
lightbend play_frameworkfrom 2.8.3 up to 2.8.15NVD

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD5.0medium CVSS:2.0AV:N/AC:L/Au:N/C:N/I:N/A:P

Classification

CWE-400

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

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.

GitHub Advisory Database
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.

NVD (es)

Play Framework es un framework web para Java y Scala. Se ha detectado una vulnerabilidad de denegación de servicio en las versiones 2.8.3 a 2.8.15 de la biblioteca de formularios de Play, tanto en la API de Scala como en la de Java. Esto puede ocurrir cuando es usado el método "Form#bindFromRequest" sobre un cuerpo de petición JSON o el método "Form#bind" directamente sobre un valor JSON. Si los datos JSON que son vinculados al formulario contienen un objeto JSON anidado profundamente o un array, la implementación de la vinculación del formulario puede consumir todo el espacio disponible en la pila y causar un "OutOfMemoryError". Si es ejecutado en el despachador por defecto y "akka.jvm-exit-on-fatal-error" está habilitado -como lo está por defecto- entonces esto puede bloquear el proceso de la aplicación. "Form.bindFromRequest" es vulnerable cuando es usado cualquier analizador de cuerpo que produce un tipo de "AnyContent" o "JsValue" en Scala, o uno que puede producir un "JsonNode" en Java. Esto incluye el analizador de cuerpos por defecto de Play. Esta vulnerabilidad ha sido parcheada en versión 2.8.16. Ahora se presenta un límite global en la profundidad de un objeto JSON que puede ser analizado, que puede ser configurado por el usuario si es necesario. Como mitigación, las aplicaciones que no necesiten analizar un cuerpo de petición de tipo "application/json" pueden cambiar el analizador de cuerpos por defecto por otro que sólo soporte el tipo de cuerpo específico que esperan

References

Sources

SourceRecordLicence
CVE ListCVE-2022-31018 changed 2025-04-23CVE Terms of Use
GitHub Advisory DatabaseGHSA-v8x6-59g4-5g3w changed 2023-11-08CC-BY-4.0
NVDCVE-2022-31018 changed 2026-06-17Public domain