Description
cJSON through 1.7.19 contains an inefficient algorithmic complexity flaw in cJSON_Compare(). When comparing objects, the function recurses into each shared subtree twice, once in each direction, with no depth guard, making the running time exponential in nesting depth. A small, deeply nested document of a few hundred bytes (depth around 40) compared for equality consumes hours of CPU, and the cost roughly doubles with each additional level of nesting. An application that calls cJSON_Compare() on attacker-influenced JSON that is structurally equal to a reference document is exposed to a denial-of-service condition.
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 +3 | No fix yet | — |
| Ubuntu 26.04 LTS | cjson +3 | No fix yet | — |
| Ubuntu 24.04 LTS | mapcache | No fix yet | — |
| Ubuntu 22.04 LTS | mapcache | No fix yet | — |
| Ubuntu 20.04 LTS | mapcache | No fix yet | — |
Show 7 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 18.04 LTS | mapcache | No fix yet | — |
| Ubuntu 16.04 LTS | mapcache | No fix yet | — |
| Ubuntu Pro 24.04 LTS | cjson +1 | No fix yet | — |
| Ubuntu Pro 22.04 LTS | cjson +1 | No fix yet | — |
| Ubuntu Pro 20.04 LTS | cjson +1 | No fix yet | — |
| Ubuntu Pro 18.04 LTS | iperf3 | No fix yet | — |
| Ubuntu Pro 16.04 LTS | iperf3 | No fix yet | — |
Azure Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Azure Linux 3 | apparmor | No fix yet | — |
References
- Security vulnerabilities in the cJSON JSON parser (Joshua Rogers) exploit
- cJSON_Compare double-recursion object comparison (cJSON.c) technical-description
- VulnCheck Advisory: cJSON cJSON_Compare Exponential Complexity Denial of Service third-party-advisory