CVE-2026-44660: UltraJSON Memory Leak on Write Failure in ujson.dump()
Summary
CVE-2026-44660: UltraJSON has a Memory Leak in ujson.dump() on Write Failure. Affects ujson versions < 5.12.1. Fixed in 5.12.1. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
UltraJSON, also known as ujson, is a high-performance JSON encoder and decoder for Python. It is designed to be faster than the standard library's JSON module, making it a popular choice for applications that require efficient JSON serialization and deserialization. However, a recent vulnerability has been identified in the ujson.dump() function, which can lead to memory leaks under certain conditions.
Vulnerability Detail
The vulnerability arises when the ujson.dump() function attempts to write serialized JSON data to a file-like object. If the write operation fails and raises an exception, the memory allocated for the serialized JSON string is not properly released, leading to a memory leak. This issue can cause applications to consume increasing amounts of memory, potentially resulting in denial of service as the application may exhaust available memory resources. The root cause is located in the objToJSONFile() function, where an early return on write failure does not decrement the reference count of the allocated string object.
How To Fix
Latest published version: 6.0.0 as of 23 Oct 2026
pip install --upgrade "ujson==6.0.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
5.12.1
This is the first release that contains the fix.
pip install --upgrade "ujson==5.12.1"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, you can replace the use of ujson.dump() with ujson.dumps() followed by a direct write to the file. Here is an example code snippet:
import ujson
class BadFile:
def write(self, s):
raise RuntimeError("boom")
obj = {"x": "A" * 200000}
try:
with open('output.json', 'w') as f:
f.write(ujson.dumps(obj))
except RuntimeError:
pass
Conclusion
The identified vulnerability in UltraJSON (CVE-2026-44660) poses a significant risk due to memory leaks caused by failed write operations in the ujson.dump() function. It is crucial for developers using this library to upgrade to the patched version or implement the suggested workaround to mitigate the risk of memory exhaustion.
See every vulnerability recorded for ujson →
FAQ
The CVSS score of this vulnerability is 8.7, indicating a high severity level.
Versions of UltraJSON up to and including 5.12.0 are affected by this vulnerability.
You can use Vulert to monitor and alert in real-time for open-source vulnerabilities in your software. You can check if your application is affected by this vulnerability using the Vulert playground at Vulert Scanner.
If you cannot upgrade immediately, consider using the provided workaround to avoid the memory leak issue.
Yes, this vulnerability specifically affects Python applications that use the UltraJSON library for JSON serialization.
References
Related vulnerabilities
Recent vulnerabilities recorded for ujson.