cJSON through 1.7.19 is vulnerable to uncontrolled recursion leading to stack exhaustion when an untrusted RFC 6902 JSON Patch is applied via cJSONUtils_ApplyPatches() or cJSONUtils_ApplyPatchesCaseSensitive(). A patch containing add and copy operations grafts duplicated subtrees to amplify document depth beyond the parser's nesting limit: cJSON_Delete() recurses with no depth bound, and the cJSON_Duplicate() guard CJSON_CIRCULAR_LIMIT is set to 10000, ten times the parser's 1000-level nesting limit and high enough to overflow a default thread stack. An attacker who can supply the patch document can crash the process, resulting in denial of service.
Fix
Patch, vendor advisory and mitigation references on NVD 2
- https://github.com/DaveGamble/cJSON/blob/v1.7.19/cJSON.c#L253-L261 Patch
- https://github.com/DaveGamble/cJSON/blob/v1.7.19/cJSON_Utils.c#L906-L940 Patch
Every line above is quoted from NVD, CISA, Microsoft, the vendor's own advisory or DISA; nothing is generated.
Change history 1
- First seenCVSS 8.7 · davegambleNVD modified 2026-10-23 23:10
Affected (CPE criteria) 1
cpe:2.3:a:davegamble:cjson:*:*:*:*:*:*:*:*
References 5
- https://github.com/DaveGamble/cJSON/blob/v1.7.19/cJSON.c#L253-L261 Patch
- https://github.com/DaveGamble/cJSON/blob/v1.7.19/cJSON_Utils.c#L906-L940 Patch
- https://joshua.hu/cjson-json-parser-cve-vulnerabilities Exploit, Press/Media Coverage, Third Party Advisory
- https://www.vulncheck.com/advisories/cjson-json-patch-copy-add-uncontrolled-recursion-stack-exhaustion Third Party Advisory
- https://joshua.hu/cjson-json-parser-cve-vulnerabilities Exploit, Press/Media Coverage, Third Party Advisory