Description
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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| DaveGamble | cJSON | ≤ 1.7.19 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | cjson | No fix yet | — |
| Debian 13 | cjson | No fix yet | — |
| Debian 12 | cjson | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | cjson | No fix yet | — |
| Ubuntu 26.04 LTS | cjson | No fix yet | — |
Show 3 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 24.04 LTS | cjson | No fix yet | — |
| Ubuntu Pro 22.04 LTS | cjson | No fix yet | — |
| Ubuntu Pro 20.04 LTS | cjson | No fix yet | — |
Azure Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Azure Linux 3 | apparmor +1 | No fix yet | — |
References
- Security vulnerabilities in the cJSON JSON parser (Joshua Rogers) exploit
- cJSON_Delete unbounded recursion (cJSON.c) technical-description
- apply_patch copy/add duplicate-and-graft (cJSON_Utils.c) technical-description
- VulnCheck Advisory: cJSON JSON Patch copy/add Uncontrolled Recursion Stack Exhaustion third-party-advisory