Python
CVE-2026-32875
HIGH
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Primary rating from Vendor (https://github.com/ultrajson/ultrajson).
CVSS VectorVendor: https://github.com/ultrajson/ultrajson
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Lifecycle Timeline
3Blast Radius
ecosystem impact- 23 pypi packages depend on ujson (19 direct, 4 indirect)
Ecosystem-wide dependent count for version 5.1.0.
DescriptionCVE.org
Summary
ujson.dumps() crashes the Python interpreter (segmentation fault) when the product of the indent parameter and the nested depth of the input exceeds INT32_MAX. It can also get stuck in an infinite loop if the indent is a large negative number. Both are caused by an integer overflow/underflow whilst calculating how much memory to reserve for indentation. And both can be used to achieve denial of service.
(Note: A negative indent to ujson means add spaces after colons but do not add line breaks or indentation. It is unclear to the current maintainers whether this was ever even an intended feature or just a byproduct of the way it was written.)
Exploitability
To be vulnerable, a service must call ujson.dump()/ujson.dumps()/ujson.encode() whilst giving untrusted users control over the indent parameter and not restrict that indentation to reasonably small non-negative values. (Even with the fix for this vulnerability, such usage is strongly advised against since even a bug-free JSON serialiser would be vulnerable to denial of service simply by the attacker requesting indents that have the server needlessly filling out gigabytes of whitespace.)
A service may also be vulnerable to the infinite loop if it uses a fixed _negative_ indent. An underflow always occurs for any negative indent when the input data is at least one level nested but, for small negative indents, the underflow is usually accidentally rectified by another overflow. As far as the maintainers are aware, the infinite loop can not be reached for indentations from -1 to -65536 / max_recursion_depth_as_limited_by_stack_size but users of negative indents are encouraged to consider their service affected even if the infinite loop seems unreachable.
Example
import ujson
def example(depth, indent):
a = [0]
for i in range(1000):
a = [a]
ujson.dumps(a, indent=indent)
example(1, 2**30)
# segfault
example(1000, -200)
# infinite loopPatches
ujson 5.12.0, containing 486bd4553dc471a1de11613bc7347a6b318e37ea, promotes the integer types where the overflow occurred, skips the indentation code path for negative indent (which was supposed to be a no-op) and places an artificial cap of 1000 on the indent parameter.
Workarounds
Users who don't wish to upgrade can either use a fixed indentation, no indentation or ensure indentation is non-negative and not enormous (below 2**31 / max_recursion_depth_as_limited_by_stack_size).
References
The original bug report can be found at https://github.com/ultrajson/ultrajson/issues/700
This issue was independently discovered by @coco1629, @EthanKim88 and @vmfunc.
AnalysisAI
The ujson Python library prior to version 5.12.0 contains an integer overflow/underflow vulnerability in the dumps() function that can crash the Python interpreter (segmentation fault) or cause an infinite loop, leading to denial of service. The vulnerability affects applications that allow untrusted users to control the indent parameter when serializing JSON, or that use large negative indent values with nested data structures. A proof-of-concept demonstrating both the segfault and infinite loop conditions is provided in the vulnerability disclosure, though there is no evidence of active exploitation (not in KEV).
Technical ContextAI
The ujson library (pkg:pip/ujson) is a fast JSON encoder and decoder written in C for Python. The vulnerability stems from CWE-190 (Integer Overflow or Wraparound) occurring during memory allocation calculations for indentation whitespace. When the product of the indent parameter and nested depth exceeds INT32_MAX, an integer overflow occurs while calculating buffer size. Additionally, negative indent values (which appear to be an undocumented or unintended feature that adds spaces after colons without line breaks) can trigger an integer underflow when combined with nested data structures, potentially causing an infinite loop. The C-level implementation fails to validate input bounds before performing arithmetic operations on integer types that are too small to hold the result.
RemediationAI
Upgrade ujson to version 5.12.0 or later, which contains the fix in commit 486bd4553dc471a1de11613bc7347a6b318e37ea available at https://github.com/ultrajson/ultrajson/commit/486bd4553dc471a1de11613bc7347a6b318e37ea. The patch promotes integer types to prevent overflow, skips indentation code for negative indent values, and enforces a hard cap of 1000 on the indent parameter. For systems unable to upgrade immediately, implement application-level controls to either use fixed indentation values, disable indentation entirely, or validate that any user-supplied indent parameter is non-negative and below 2^31 divided by the maximum recursion depth. As a general security practice, avoid exposing JSON serialization formatting parameters to untrusted users regardless of the library version, as even legitimate large indent values can cause resource exhaustion through excessive whitespace generation.
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
Cross-user flow execution in Langflow (< 1.9.1) lets any authenticated API-key holder run another user's flow by passing
Same weakness CWE-190 – Integer Overflow or Wraparound
View allSame technique Integer Overflow
View allVendor StatusVendor
Share
External POC / Exploit Code
Leaving vuln.today
GHSA-c8rr-9gxc-jprv