{"id":"CVE-2026-54911","aliases":["CVE-2026-54911","GHSA-3j69-69wj-xqx2","PYSEC-2026-2294"],"related":[],"kind":"vulnerability","state":"published","title":"UltraJSON: Malformed/Truncated UTF-8 Accepted and Silently Rewritten in ujson.dumps()","summary":"UltraJSON is a fast JSON encoder and decoder written in pure C with bindings for Python 3.7+. Prior to 5.13.0, 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. This vulnerability is fixed in 5.13.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"UltraJSON is a fast JSON encoder and decoder written in pure C with bindings for Python 3.7+. Prior to 5.13.0, 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. This vulnerability is fixed in 5.13.0.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"}],"published":"2026-06-19T20:47:43.000Z","modified":"2026-09-10T03:50:55.310Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-20"],"affected":[{"ranges":[{"version":"< 5.13.0","status":"affected"}],"vendor":"ultrajson","product":"ultrajson","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.13.0"}],"ecosystem":"PyPI","package":"ujson","purl":"pkg:pypi/ujson","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"5.13.0"}],"vendor":"ultrajson_project","product":"ultrajson","cpe":"cpe:2.3:a:ultrajson_project:ultrajson:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.13.0"}],"ecosystem":"PyPI","package":"ujson","purl":"pkg:pypi/ujson","source":"pysec"}],"references":[{"url":"https://github.com/ultrajson/ultrajson/security/advisories/GHSA-3j69-69wj-xqx2","tags":["fix","mitigation","patch","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/ultrajson/ultrajson/commit/169eaf36b1116fece5034ee79a7a0ef3f6deedcf","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/ultrajson/ultrajson/releases/tag/5.13.0","tags":["advisory","product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-54911","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/ujson/PYSEC-2026-2294.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/ultrajson/ultrajson","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-06-23T14:19:57.855Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-54911","url":"https://www.cve.org/CVERecord?id=CVE-2026-54911","licence":"CVE Terms of Use","modified":"2026-06-23T14:20:13.488Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-3j69-69wj-xqx2","url":"https://github.com/advisories/GHSA-3j69-69wj-xqx2","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:55.310Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-54911","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-54911","licence":"Public domain","modified":"2026-06-26T20:10:54.850Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2294","url":"https://osv.dev/vulnerability/PYSEC-2026-2294","licence":"CC-BY-4.0","modified":"2026-07-13T07:15:45.403Z"}],"updatedAt":"2026-11-25T22:59:25.426Z","epss":{"score":0.00272,"percentile":0.20979,"date":"2026-12-01T12:00:22.000Z"}}