CVE-2026-16554

Integer Overflow Leading to Heap Buffer Overflow in cJSON

Published Jul 27, 2026 CVSS 4.0 · 5.1 Medium EPSS < 1% KEV · Not listed
Description
cJSON library is vulnerable to an integer overflow in the print_string_ptr() function in cJSON.c on 32-bit platforms. The escape_characters counter, a 32-bit size_t, can wrap around when processing strings containing approximately 858,993,460 or more control characters, causing the output buffer to be allocated based on an underestimated length. When cJSON_PrintBuffered() is used with a pre-allocated buffer, the subsequent write loop overflows the heap allocation. An attacker supplying a crafted JSON string to an application using cJSON on a 32-bit platform can cause a heap buffer overflow, potentially leading to remote code execution, information disclosure, or denial of service.




Because project creator contact attempts were unsuccessful, the vulnerability has only been confirmed in version 1.7.19 but may also affect other versions.

Analysis

AI-generated

Technical impact

cJSON contains an integer overflow (CWE‑131/CWE‑190) in the print_string_ptr() function that happens only on 32‑bit platforms when processing JSON strings with a large number of control characters. The overflow causes an underestimate of the buffer size needed for cJSON_PrintBuffered(), and the subsequent write loop overflows the heap. An attacker who can supply a crafted JSON payload to an application that uses cJSON may exploit this overflow, leading to remote code execution, information disclosure or denial of service.

Affected Systems

The vendor DaveGamble’s cJSON library is affected. Version 1.7.19 is confirmed vulnerable and other releases built for 32‑bit environments are likely impacted. The flaw does not apply to 64‑bit builds, where the sizeof(size_t) arithmetic does not overflow.

Risk and Exploitability

The CVSS score is 5.1, indicating moderate severity, while the EPSS score is < 1% and the vulnerability is not listed in CISA’s KEV catalog. The attack vector is inferred to be remote or local: an untrusted program or network interface that parses JSON with cJSON can trigger the vulnerability. Exploitation requires a 32‑bit environment and use of cJSON_PrintBuffered() with a pre‑allocated buffer, conditions commonly found in embedded or legacy software.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade cJSON to the latest patch release that resolves the integer overflow.
  • Deploy the library on a 64‑bit platform or remove any 32‑bit binaries from the environment to eliminate the size_t under‑overflow condition.
  • If an immediate upgrade is not possible, avoid calling cJSON_PrintBuffered() with a pre‑allocated buffer or validate the JSON payload size before processing to mitigate the risk of a heap overflow.

Generated by OpenCVE AI on August 5, 2026 at 00:10 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
CPEs cpe:2.3:a:davegamble:cjson:1.7.19:*:*:*:*:*:*:*
Metrics cvssV3_1

{'score': 6.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L'}

cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

Type Values Removed Values Added
Weaknesses CWE-131
References
Metrics threat_severity

None

cvssV3_1

{'score': 6.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L'}

threat_severity

Moderate

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Davegamble
Davegamble cjson
Vendors & Products Davegamble
Davegamble cjson
Type Values Removed Values Added
Description cJSON library is vulnerable to an integer overflow in the print_string_ptr() function in cJSON.c on 32-bit platforms. The escape_characters counter, a 32-bit size_t, can wrap around when processing strings containing approximately 858,993,460 or more control characters, causing the output buffer to be allocated based on an underestimated length. When cJSON_PrintBuffered() is used with a pre-allocated buffer, the subsequent write loop overflows the heap allocation. An attacker supplying a crafted JSON string to an application using cJSON on a 32-bit platform can cause a heap buffer overflow, potentially leading to remote code execution, information disclosure, or denial of service. Because project creator contact attempts were unsuccessful, the vulnerability has only been confirmed in version 1.7.19 but may also affect other versions.
Title Integer Overflow Leading to Heap Buffer Overflow in cJSON
Weaknesses CWE-190
References
Metrics cvssV4_0

{'score': 5.1, 'vector': 'CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:L/SI:L/SA:L'}

Weaknesses
  • CWE-131

    Incorrect Calculation of Buffer Size

  • CWE-190

    Integer Overflow or Wraparound

Sources

Status
PUBLISHED
Assigner
CERT-PL
Published
Updated
Jul 31, 2026, 1:34 PM
Reserved
Jul 22, 2026, 11:49 AM
Status
Analyzed
Published
Jul 27, 2026, 9:16 AM
Modified
Oct 24, 2026, 1:10 PM
Severity
Moderate
Public date
Jul 27, 2026, 8:40 AM