DoS Vulnerability in JSON-Java
Description
JSON-Java up to 20230618 has a parser bug where an embedded null byte (\0) is confused with EOF, causing unbounded memory allocation and denial of service.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
JSON-Java up to 20230618 has a parser bug where an embedded null byte (\0) is confused with EOF, causing unbounded memory allocation and denial of service.
Vulnerability
Description
CVE-2023-5072 is a denial-of-service (DoS) vulnerability in the JSON-Java (org.json) library up to version 20230618. The root cause is a parser bug where the null character (\0) is indistinguishable from the end-of-file (EOF) marker in the tokenizer [1][2]. This confusion leads the parser to skip past valid content, continuing to read and allocate memory indefinitely when processing a specially crafted JSON input of modest size [1].
Exploitation
An attacker can exploit this by supplying a JSON string containing embedded null characters. No authentication is required; the vulnerability is triggered solely by parsing the malicious input. The issue is tracked in GitHub issue #758, and a fix was proposed in pull request #759, which changes the parser to properly detect embedded \0 values instead of treating them as EOF [2][4].
Impact
Successful exploitation results in uncontrolled memory consumption, leading to an OutOfMemoryError and denial of service for any application using the affected library to parse untrusted JSON data [1][2]. The impact is limited to availability; confidentiality and integrity are not affected.
Mitigation
The vulnerability is fixed in release 20231013 and later, with the patch merged via pull request #759 [3][4]. Users should upgrade to a patched version immediately. There is no known workaround short of sanitizing input to remove null bytes, which is not recommended as a permanent solution.
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
org.json:jsonMaven | < 20231013 | 20231013 |
Affected products
4- osv-coords3 versions
< 3.3.6-r15+ 2 more
- (no CPE)range: < 3.3.6-r15
- (no CPE)range: < 1.0.78-r2
- (no CPE)range: < 20231013
- https://github.com/stleary/JSON-java/n/av5Range: 0
Patches
160662e2f8384Merge pull request #759 from eamonnmcmanus/eofnull
2 files changed · +12 −0
src/main/java/org/json/JSONObject.java+3 −0 modified@@ -256,6 +256,9 @@ public JSONObject(JSONTokener x) throws JSONException { if (x.nextClean() == '}') { return; } + if (x.end()) { + throw x.syntaxError("A JSONObject text must end with '}'"); + } x.back(); break; case '}':
src/test/java/org/json/junit/JSONObjectTest.java+9 −0 modified@@ -2225,6 +2225,15 @@ public void jsonObjectParsingErrors() { "Expected a ',' or '}' at 15 [character 16 line 1]", e.getMessage()); } + try { + // \0 after , + String str = "{\"myKey\":true, \0\"myOtherKey\":false}"; + assertNull("Expected an exception",new JSONObject(str)); + } catch (JSONException e) { + assertEquals("Expecting an exception message", + "A JSONObject text must end with '}' at 15 [character 16 line 1]", + e.getMessage()); + } try { // append to wrong key String str = "{\"myKey\":true, \"myOtherKey\":false}";
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
9- github.com/advisories/GHSA-4jq9-2xhw-jpx7ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2023-5072ghsaADVISORY
- github.com/google/security-research/security/advisories/GHSA-4jq9-2xhw-jpx7ghsaWEB
- github.com/stleary/JSON-java/commit/60662e2f8384d3449822a3a1179bfe8de67b55bbghsaWEB
- github.com/stleary/JSON-java/issues/758ghsaWEB
- github.com/stleary/JSON-java/issues/771ghsaWEB
- github.com/stleary/JSON-java/pull/759ghsaWEB
- www.openwall.com/lists/oss-security/2023/12/13/4mitre
- security.netapp.com/advisory/ntap-20240621-0007/mitre
News mentions
1- Jenkins Security Advisory 2023-12-13Jenkins Security Advisories · Dec 13, 2023