CVE-2026-44660: Ujson UltraJSON Has A Memory Leak Vulnerability
HIGHCVE-2026-44660 is a HIGH (CVSS 7.5) ultrajson has a memory leak vulnerability (CWE-401: Missing Release of Memory after Effective Lifetime) affecting Ujson libraries in the PyPI ecosystem. The issue involves ultrajson has a memory leak in ujson.dump() on write failure. Remediation is available by upgrading affected packages to version 5.12.1.
CVE-2026-44660 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-44660
To remediate this vulnerability, upgrade all affected Ujson dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install ujson>=5.12.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show ujson
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-44660, inspect your installed packages using pip:
pip show ujson
Analyze the terminal output to locate any version of Ujson in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.12.1), your application is affected.
Note: The pip show ujson command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-401: Missing Release of Memory after Effective Lifetime, where the product does not sufficiently track and release allocated memory after it has been used, making the memory unavailable for reallocation and reuse. In Ujson, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-44660 Affected Ujson Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ujson
|
PyPI |
< 5.12.1
|
5.12.1
|
References
Frequently Asked Questions
What is CVE-2026-44660?
Which Ujson versions are affected?
What version fixes CVE-2026-44660?
Is ujson affected?
What is the CVSS score of CVE-2026-44660?
What CWE is associated with CVE-2026-44660?
How can I check PyPI dependencies for CVE-2026-44660?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-c38f-wx89-p2xg",
"modified" : "2026-06-08T23:53:55Z",
"published" : "2026-05-12T22:25:11Z",
"aliases" : [ "CVE-2026-44660" ],
"summary" : "UltraJSON has a Memory Leak in ujson.dump() on Write Failure",
"details" : "### Summary\n\nWhen `ujson.dump()` writes to a file-like object and the write operation raises an exception, the serialized JSON string object is not decremented, leaking memory. Each failed write operation leaks the full size of the serialized payload.\n\nCode that uses `ujson.dumps()` rather than `ujson.dump()` or only JSON load/decode methods is unaffected.\n\n### Details\n\n**Vulnerability Location:**\n- `src/ujson/python/objToJSON.c:913` - `objToJSONFile()` function start\n- `src/ujson/python/objToJSON.c:931` - Error return on write failure\n- `src/ujson/python/objToJSON.c:942` - Early return without cleanup\n \n**Root Cause:**\n\nThe `objToJSONFile()` function allocates a Python string object via `ujson_dumps_internal()`, calls the file's `write()` method, and returns early if `write()` raises an exception—but never calls `Py_DECREF(string)` on the early exit path.\n\n### PoC\n```python\nimport gc, tracemalloc, ujson\n\nclass BadFile:\n def write(self, s):\n raise RuntimeError(\"boom\")\n\nobj = {\"x\": \"A\" * 200000}\n\ndef run():\n try:\n ujson.dump(obj, BadFile())\n except RuntimeError:\n pass\n\nrun()\ntracemalloc.start()\ngc.collect()\nbase = tracemalloc.get_traced_memory()[0]\n\nfor i in range(5):\n run()\n gc.collect()\n cur = tracemalloc.get_traced_memory()[0]\n print(i, cur - base)\n```\n\n### Impact\n\nAny application that serializes data through `ujson.dump()` to an attacker-influenced file-like object that can fail can be driven into linear memory growth. An attacker can quickly use up all the memory of say a web server that sends JSON responses using `ujson.dump()` by repeatedly making requests then closing the connection mid response.\n\n### Remediation\n\nThe missing dec-refs were added in 82af1d0ac01d09aa40c887b460d44b9d9f4bccd9. We recommend upgrading to [UltraJSON 5.12.1](https://github.com/ultrajson/ultrajson/releases/tag/5.12.1).\n\n### Workarounds\n\nReplacing `ujson.dump(obj, file)` with `file.write(ujson.dumps(obj))` is equivalent (contrary to popular misconception, there are no streaming benefits to using `ujson.dump()`) and will avoid the memory leak.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "ujson"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.12.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.12.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/ultrajson/ultrajson/security/advisories/GHSA-c38f-wx89-p2xg"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-44660"
}, {
"type" : "WEB",
"url" : "https://github.com/ultrajson/ultrajson/commit/82af1d0ac01d09aa40c887b460d44b9d9f4bccd9"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ultrajson/ultrajson"
}, {
"type" : "WEB",
"url" : "https://github.com/ultrajson/ultrajson/releases/tag/5.12.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-401" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-12T22:25:11Z",
"nvd_published_at" : "2026-05-27T21:16:17Z"
}
}