JFrog Security Research
< Back

XRAY-427633 - json-smart Stack exhaustion DoS

CVE-2023-1370 | CVSS 7.5

JFrog Severity:high

Discovered ByOri Hollanderof the JFrog Security Research Team

Published 13 Mar, 2023 | Last updated 13 Mar, 2023

Stack exhaustion in json-smart leads to denial of service when parsing malformed JSON



Json-smart is a performance focused, JSON processor lib. When reaching a [ or { character in the JSON input, the code parses an array or an object respectively. It was discovered that the code does not have any limit to the nesting of such arrays or objects. Since the parsing of nested arrays and objects is done recursively, nesting too many of them can cause a stack exhaustion (stack overflow) and crash the software.

The following code will raise a StackOverflowError:

StringBuilder s = new StringBuilder();
for (int i = 0; i < 10000 ; i++) {
for (int i = 0; i < 10000 ; i++) {
JSONParser p = new JSONParser(JSONParser.MODE_JSON_SIMPLE);

No mitigations are supplied for this issue

Fix commit

< Back