Executive brief
UltraJSON is a high-performance tool used by Python applications to process data in the JSON format. A flaw in certain versions allows a remote attacker to crash a service by sending specially crafted data containing very large numbers. This causes the application to consume all available memory, leading to a denial of service that can disrupt business operations and application availability.
Technical details
A memory leak exists in UltraJSON's C implementation when parsing integers outside the range of [-2^63, 2^64 - 1]. The root cause is located in 'src/ujson/python/JSONtoObj.c' within the 'Object_newIntegerFromString' function, where memory allocated via 'PyObject_Malloc' for a string representation of the integer was not released after calling 'PyLong_FromString'. An attacker can exploit this by sending JSON payloads containing many large integers to any service using 'ujson.load()', 'ujson.loads()', or 'ujson.decode()'. This leak occurs even if the integer is eventually rejected by Python's 'sys.get_int_max_str_digits()' limit, allowing for arbitrary memory exhaustion. The issue is fixed in version 5.12.0 by adding the missing 'PyObject_Free' call.
Affected products
- ultrajson UltraJSON (ujson) >= 5.4.0, < 5.12.0
Timeline
- 2026-03-11: patched: Version 5.12.0 released with fix.
- 2026-03-17: advisory: GitHub Security Advisory published.
- 2026-03-20: disclosed: CVE-2026-32874 published to NVD.
References
- https://github.com/ultrajson/ultrajson/commit/4baeb950df780092bd3c89fc702a868e99a3a1d2
- https://github.com/ultrajson/ultrajson/releases/tag/5.12.0
- https://github.com/ultrajson/ultrajson/security/advisories/GHSA-wgvc-ghv9-3pmm
- https://access.redhat.com/security/cve/CVE-2026-32874
- https://bugzilla.redhat.com/show_bug.cgi?id=2449411
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32874.json