Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSend crafted JSON to a cJSON merge-patch endpoint
-
DeliveryApplication extracts patch as a subtree of target
-
ExploitcJSONUtils_MergePatch called with aliased pointers
-
ExecutioncJSON_Delete(target) frees patch memory
-
PersistcJSON_Duplicate reads freed heap region
-
ImpactCrash, heap disclosure, or memory corruption
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Memory lifecycle management
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Privilege Escalation The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires that the consuming application call cJSONUtils_MergePatch(target, patch) where the patch pointer is a node within target's own allocated tree - specifically, a subtree obtained via cJSON_GetObjectItem() or equivalent on the same target object, rather than an independently parsed or constructed JSON value. This aliasing pattern is uncommon in typical usage but can occur in applications that allow clients to specify which existing field to use as the patch. Applications that always construct patch objects independently from target objects are not vulnerable. Additionally, reliable code execution beyond DoS requires a favourable heap layout following the free, which is allocator- and platform-dependent and not guaranteed. |
| Impact | The CVSS 4.0 score of 6.9 with AV:N/AC:L/PR:N/UI:N reflects a remotely triggerable flaw in an unauthenticated context, but the AC:L rating warrants scrutiny. The UAF fires only when the patch argument is a pointer into the target's own JSON tree - an application-level aliasing condition that many call sites will not produce naturally. In practice, exploitability depends heavily on how the consuming application wires the merge-patch API: if an attacker controls a JSON endpoint that applies a user-supplied patch to an object containing the user's own sub-fields, the condition can be engineered, but a typical server-side usage with independently constructed patch objects would not be vulnerable. A public PoC exists (E:P in the provided CVSS 4.0), which meaningfully raises urgency. No CISA KEV listing is present and no EPSS data was provided. The primary confirmed impact is heap-use-after-free leading to crash (DoS); memory disclosure or arbitrary code execution are theoretically possible depending on heap layout and allocator behaviour but are not confirmed by available data. |
| Exploit ScenarioDerived | An attacker sends a crafted JSON payload to a REST API or embedded device endpoint that internally extracts a sub-field from the stored target document and passes it as the patch argument to cJSONUtils_MergePatch() - for example, an update handler that merges a user-nominated key from an existing record back onto the record itself. When cJSON_Delete(target) executes, the patch memory is freed mid-operation, and the subsequent cJSON_Duplicate() reads the freed heap region, causing a crash or potentially leaking heap metadata. A public PoC demonstrating this scenario with AddressSanitizer output is available at https://github.com/DaveGamble/cJSON/issues/1060. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Sep 10, 2026
Heap use-after-free in DaveGamble cJSON's cJSONUtils_MergePatch function (cJSON_Utils.c) affects all versions through 1.7.19 when the patch argument is a subtree of the target object. The function deletes the target before duplicating the patch, freeing the patch memory and causing a subsequent read of freed heap - confirmed by an AddressSanitizer-triggering test case in upstream fix PR #1065. A public exploit exists (GitHub issue #1060) and can lead to crash, potential memory disclosure, or memory corruption in any application that passes attacker-influenced JSON through this specific merge-patch call pattern.
RemediationAI
A fix is available as GitHub PR #1065 (https://github.com/DaveGamble/cJSON/pull/1065) against the main branch, but it had not been merged into a tagged release at time of analysis - the description explicitly states the PR 'awaits acceptance', so a released patched version is not independently confirmed. Maintainers or downstream consumers should apply the one-line ordering change from PR #1065 to their local copy: call cJSON_Duplicate(patch, 1) and store the result before calling cJSON_Delete(target), then return the duplicate. As an immediate compensating control, callers of cJSONUtils_MergePatch() should ensure the patch argument is always an independently allocated tree with no shared ownership with target, eliminating the aliasing condition that triggers the UAF. Applications that do not call cJSONUtils_MergePatch() at all are unaffected.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
cJSON (CPE: cpe:2.3:a:davegamble:cjson:*) is a lightweight, single-file JSON parser and builder written in C, widely embedded in firmware, IoT devices, and C-based application stacks. The cJSON_Utils.c module implements RFC 7396 JSON Merge Patch via cJSONUtils_MergePatch(). The root cause (CWE-416: Use After Free) is an ordering bug in the internal merge_patch() helper: when the patch pointer refers to a node inside the target tree, calling cJSON_Delete(target) frees the memory backing the patch, then the immediately following cJSON_Duplicate(patch, 1) reads that freed memory. The fix in PR #1065 duplicates the patch before deleting the target - the comment in the diff explicitly documents the aliasing hazard: 'otherwise cJSON_Delete(target) would free the patch memory and the subsequent cJSON_Duplicate would read freed memory.'
Know when Cjson gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P
AC:H because the UAF triggers only when patch is aliased as a subtree of target, a specific application-level condition absent from typical usage; C/I/A:L reflects UAF impact class without confirmed full code execution.
Primary rating from Vendor (VulDB).
CVSS VectorVendor: VulDB
Lifecycle Timeline
2DescriptionCVE.org
A vulnerability was found in DaveGamble cJSON up to 1.7.19. The affected element is the function cJSONUtils_MergePatch of the file cJSON_Utils.c. The manipulation results in use after free. The attack may be launched remotely. The exploit has been made public and could be used. The pull request to fix this issue awaits acceptance.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Use-after-free vulnerabilities occur when a program continues to access memory through a pointer after that memory has been deallocated.
Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
cJSON 1.5.0 through 1.7.18 allows out-of-bounds access via the decode_array_index_from_pointer function in cJSON_Utils.c
cJSON before 1.7.11 allows out-of-bounds access, related to multiline comments. Rated critical severity (CVSS 9.8), this
cJSON before 1.7.11 allows out-of-bounds access, related to \x00 in a string literal. Rated critical severity (CVSS 9.8)
Dave Gamble cJSON version 1.7.3 and earlier contains a CWE-416: Use After Free vulnerability in cJSON library that can r
Dave Gamble cJSON version 1.7.2 and earlier contains a CWE-415: Double Free vulnerability in cJSON library that can resu
cJSON v1.7.17 was discovered to contain a segmentation violation, which can trigger through the second parameter of func
cJSON v1.7.16 was discovered to contain a segmentation violation via the function cJSON_SetValuestring at cJSON.c. Rated
cJSON v1.7.16 was discovered to contain a segmentation violation via the function cJSON_InsertItemInArray at cJSON.c. Ra
DaveGamble/cJSON cJSON 1.7.8 is affected by: Improper Check for Unusual or Exceptional Conditions. Rated high severity (
Denial of service in cJSON (DaveGamble's C JSON parser) through version 1.7.19 lets a remote attacker crash any applicat
Denial of service in the cJSON C library (versions through 1.7.19) arises from exponential algorithmic complexity in the
Dave Gamble cJSON version 1.7.6 and earlier contains a CWE-772 vulnerability in cJSON library that can result in Denial
EUVD-2026-75225
GHSA-7jcg-95pj-h5fp
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB