# CVE-2026-32874: UltraJSON memory leak in JSON parsing of large integers

Source: https://junglewise.ai/threats/cve-2026-32874-ultrajson-memory-leak-in-json-parsing-of-large-integers  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-03-20. Updated: 2026-06-30  
License: CC BY 4.0 with a link back

CVE-2026-32874 · Severity: high · CVSS 7.5 · Published 2026-03-20

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.

Technologies: [ujson (PyPI)](https://junglewise.ai/threats/technologies/ujson), [UltraJSON](https://junglewise.ai/threats/technologies/ultrajson). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi), [UltraJSON](https://junglewise.ai/threats/vendors/ultrajson).

## Quick answers

**Is CVE-2026-32874 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-32874 being exploited in the wild.

**How severe is CVE-2026-32874?** High severity, with a CVSS score of 7.5, published 20 March 2026.

**Which products and versions are affected?** ujson (PyPI) ECOSYSTEM:introduced=5.4.0,fixed=5.12.0; UltraJSON >= 5.4.0, < 5.12.0.

**Is there a fix for CVE-2026-32874?** Yes. ujson (PyPI): upgrade to 5.12.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-32874 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-32874?** Check whether you run ujson (PyPI) or UltraJSON at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- ujson (PyPI): upgrade to 5.12.0 or later

  ```sh
  pip install "ujson>=5.12.0"
  ```


## 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

## Identifiers

- CVE-2026-32874
- GHSA-wgvc-ghv9-3pmm
- PYSEC-2026-2291

## 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/commit/4baeb950df780092bd3c89fc702a868e99a3a1d2)
- [https://github.com/ultrajson/ultrajson/releases/tag/5.12.0](https://github.com/ultrajson/ultrajson/releases/tag/5.12.0)
- [https://github.com/ultrajson/ultrajson/security/advisories/GHSA-wgvc-ghv9-3pmm](https://github.com/ultrajson/ultrajson/security/advisories/GHSA-wgvc-ghv9-3pmm)
- [https://access.redhat.com/security/cve/CVE-2026-32874](https://access.redhat.com/security/cve/CVE-2026-32874)
- [https://bugzilla.redhat.com/show_bug.cgi?id=2449411](https://bugzilla.redhat.com/show_bug.cgi?id=2449411)
- [https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32874.json](https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32874.json)

## Related threats

- [PYSEC-2026-1057 - Incorrect handling of invalid surrogate pair characters](https://junglewise.ai/threats/cve-2022-31116-incorrect-handling-of-invalid-surrogate-pair-characters)
- [PYSEC-2026-1056 - Potential double free of buffer during string decoding](https://junglewise.ai/threats/cve-2022-31117-potential-double-free-of-buffer-during-string-decoding)
- [UltraJSON improper input validation in ujson.dumps UTF-8 handling](https://junglewise.ai/threats/cve-2026-54911-ultrajson-improper-input-validation-in-ujson-dumps-utf-8-handling)
- [UltraJSON memory leak in ujson.dump on write failure](https://junglewise.ai/threats/cve-2026-44660-ultrajson-memory-leak-in-ujson-dump-on-write-failure)
- [UltraJSON integer overflow in indent handling](https://junglewise.ai/threats/cve-2026-32875-ultrajson-integer-overflow-in-indent-handling)
