Vulnerabilities in pkg:pypi/ujson

PACKAGE
Advisory Identifier: GHSA-3j69-69wj-xqx2
Advisory Summary

CVE-2026-54911 is a MODERATE (CVSS 6.5) malformed/truncated utf-8 accepted and silently vulnerability (CWE-20: Improper Input Validation) affecting UltraJSON libraries in the PyPI ecosystem. The issue involves malformed/truncated utf-8 accepted and silently rewritten in ujson.dumps(). Remediation is available by upgrading affected packages to version 5.13.0.

7 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/ujson

7 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/ujson. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-3j69-69wj-xqx2 CVE-2026-54911 MODERATE UltraJSON: Malformed/Truncated UTF-8 Accepted and Silently Rewritten in ujson.dumps()
GHSA-c38f-wx89-p2xg CVE-2026-44660 HIGH UltraJSON has a Memory Leak in ujson.dump() on Write Failure
GHSA-c8rr-9gxc-jprv CVE-2026-32875 HIGH UltraJSON has an integer overflow handling large indent leads to buffer overflow or infinite loop
GHSA-wgvc-ghv9-3pmm CVE-2026-32874 HIGH UltraJSON has a Memory Leak parsing large integers allows DoS
GHSA-fh56-85cw-5pq6 CVE-2021-45958 MODERATE UltraJSON vulnerable to Out-of-bounds Write
GHSA-wpqr-jcpx-745r CVE-2022-31116 HIGH Incorrect handling of invalid surrogate pair characters
GHSA-fm67-cv37-96ff CVE-2022-31117 MODERATE Potential double free of buffer during string decoding

CVE-2026-54911 at a Glance

CVE Identifier CVE-2026-54911
GHSA Identifier GHSA-3j69-69wj-xqx2
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-20: Improper Input Validation
Affected Product UltraJSON
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.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:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-54911

To remediate this vulnerability, upgrade all affected UltraJSON dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ujson fixed: 5.13.0
pip install ujson>=5.13.0
Verify Direct and Transitive Dependencies

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-54911, inspect your installed packages using pip:

pip show ujson

Analyze the terminal output to locate any version of UltraJSON in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.13.0), 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In UltraJSON, 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

### Summary `ujson.dumps()` (or `ujson.dump()` or `ujson.encode()`) have a `reject_bytes=False` option. When set, they may accept malformed or truncated UTF-8 byte sequences, silently rewriting them into different Unicode characters instead of rejecting them. This leads to input validation bypass and data integrity issues. ### Details The expected behavior is that for `x` being any bytes string, `x == ujson.loads(ujson.dumps(x, reject_bytes=False)).encode(errors="surrogatepass")` should always either be true or `ujson.dumps()` will throw an exception. In reality, some strings which should've been errors are silently rewritten as other strings: * Invalid continuation bytes are replaced with valid ones: `b'\xcf\x13'` -> `b'\xcf\x93'` * Unterminated sequence completes the sequence: `b'\xc3'` -> `b'\xc3\x80'` * ... or leads to reading past the end of string: `b'\xf0\x90\x94'` -> `b"\xf0\x90\x94\x80inxcontrib'"` ### Impact An application relying on reject_bytes=False for UTF-8 handling may experience: - Data integrity issues - Experience validation bypass if said validation occurs before serialisation ### Remediation The missing/broken UTF-8 validation checks were added/fixed in https://github.com/ultrajson/ultrajson/commit/169eaf36b1116fece5034ee79a7a0ef3f6deedcf. We recommend upgrading to [UltraJSON 5.13.0](https://github.com/ultrajson/ultrajson/releases/tag/5.13.0). ### Workarounds Decoding bytes to strings in Python before passing them to `ujson.dumps()` avoids this issue.

CVE-2026-54911 Affected UltraJSON Versions

1 component(s)
Fixed Versions:
5.13.0
Product / Package Ecosystem Affected Versions Fixed Version
ujson
PyPI
< 5.13.0
5.13.0

References

Frequently Asked Questions

What is CVE-2026-54911?
CVE-2026-54911 is a security vulnerability in UltraJSON involving Malformed/Truncated UTF-8 Accepted and Silently Rewritten in ujson.dumps() under CWE-20: Improper Input Validation.
Which UltraJSON versions are affected?
Affected versions include releases prior to 5.13.0 across affected packages: ujson.
What version fixes CVE-2026-54911?
Upgrading to 5.13.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ujson affected?
Yes, ujson is affected in releases prior to 5.13.0. Upgrade your dependency to 5.13.0 or later.
What is the CVSS score of CVE-2026-54911?
CVE-2026-54911 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2026-54911?
CVE-2026-54911 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check PyPI dependencies for CVE-2026-54911?
Run the dependency tree command: 'pip show ujson'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3j69-69wj-xqx2",
  "modified" : "2026-07-18T17:28:55Z",
  "published" : "2026-06-19T20:47:43Z",
  "aliases" : [ "CVE-2026-54911" ],
  "summary" : "UltraJSON: Malformed/Truncated UTF-8 Accepted and Silently Rewritten in ujson.dumps()",
  "details" : "### Summary\n`ujson.dumps()` (or `ujson.dump()` or `ujson.encode()`) have a `reject_bytes=False` option. When set, they may accept malformed or truncated UTF-8 byte sequences, silently rewriting them into different Unicode characters instead of rejecting them. This leads to input validation bypass and data integrity issues.\n\n### Details\n\nThe expected behavior is that for `x` being any bytes string, `x == ujson.loads(ujson.dumps(x, reject_bytes=False)).encode(errors=\"surrogatepass\")` should always either be true or `ujson.dumps()` will throw an exception. In reality, some strings which should've been errors are silently rewritten as other strings:\n\n* Invalid continuation bytes are replaced with valid ones: `b'\\xcf\\x13'` -> `b'\\xcf\\x93'`\n* Unterminated sequence completes the sequence: `b'\\xc3'` -> `b'\\xc3\\x80'`\n* ... or leads to reading past the end of string: `b'\\xf0\\x90\\x94'` -> `b\"\\xf0\\x90\\x94\\x80inxcontrib'\"`\n\n### Impact\n\nAn application relying on reject_bytes=False for UTF-8 handling may experience:\n\n- Data integrity issues\n- Experience validation bypass if said validation occurs before serialisation\n\n### Remediation\n\nThe missing/broken UTF-8 validation checks were added/fixed in https://github.com/ultrajson/ultrajson/commit/169eaf36b1116fece5034ee79a7a0ef3f6deedcf. We recommend upgrading to [UltraJSON 5.13.0](https://github.com/ultrajson/ultrajson/releases/tag/5.13.0).\n\n### Workarounds\n\nDecoding bytes to strings in Python before passing them to `ujson.dumps()` avoids this issue.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "ujson"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.13.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.12.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ultrajson/ultrajson/security/advisories/GHSA-3j69-69wj-xqx2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-54911"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ultrajson/ultrajson/commit/169eaf36b1116fece5034ee79a7a0ef3f6deedcf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/ujson/PYSEC-2026-2294.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ultrajson/ultrajson"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ultrajson/ultrajson/releases/tag/5.13.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-19T20:47:43Z",
    "nvd_published_at" : "2026-06-22T22:16:50Z"
  }
}