GHSA-cc4v-rvgp-2pf3
Jawn: Uncontrolled nesting depth in JSON parser
Quick fix
GHSA-cc4v-rvgp-2pf3 — org.typelevel:jawn-parser_2.12: upgrade to the fixed version with the command below.
# pom.xml: bump <version>1.7.0</version> for org.typelevel:jawn-parser_2.12Details
The Jawn parser before 1.6.1 is vulnerable to a denial of service attack via untrusted input.
### Impact
A remote attacker who can submit JSON to any jawn-backed parse method can exhaust JVM heap and trigger `java.lang.OutOfMemoryError`. This is treated by Scala as a fatal error and not typically handled by `scala.util.Try` or `cats.effect.IO`.
### Patches
Version `1.6.1` introduces a configurable nesting-depth limit (`Parser#maxDepth`, default `4096`). Inputs deeper than the limit fail with a recoverable `ParseException` instead of exhausting heap.
Users who require deeper nesting may override `maxDepth` on a `Parser` subclass.
### Workarounds
- Enforce an input size limit small enough that the resulting context stack cannot exhaust heap, (e.g. http4s `EntityLimiter`). - Pre-scan untrusted input and reject documents whose maximum delimiter nesting exceeds a threshold before handing them to jawn.
Are you affected?
Enter the version of the package you're using.
Affected packages
0Fixed in: 1.7.0# pom.xml: bump <version>1.7.0</version> for org.typelevel:jawn-parser_2.120Fixed in: 1.7.0# pom.xml: bump <version>1.7.0</version> for org.typelevel:jawn-parser_2.130Fixed in: 1.7.0# pom.xml: bump <version>1.7.0</version> for org.typelevel:jawn-parser_3References
- https://github.com/typelevel/jawn/security/advisories/GHSA-cc4v-rvgp-2pf3[WEB]
- https://github.com/typelevel/jawn/commit/191cb3a44e77f1afab439ee636bf66bdf3c54a04[WEB]
- https://github.com/typelevel/jawn/commit/6219666641f9408498f85868f835e17bd8a72fed[WEB]
- https://github.com/typelevel/jawn/commit/93ac93e9c992c11b4c03d5455d8551f9fb24da1b[WEB]
- https://github.com/typelevel/jawn/commit/f6ace7e0db715de1a8c4618bed9378333a5c2214[WEB]
- https://github.com/typelevel/jawn[PACKAGE]
- https://github.com/typelevel/jawn/releases/tag/v1.7.0[WEB]