{"id":"CVE-2022-31116","published":"2022-07-05T17:35:11Z","modified":"2025-04-22T17:52:13Z","title":"Incorrect handling of invalid surrogate pair characters in ujson","vendor":"ultrajson","product":"ultrajson","tier":"tail","description":{"text":"UltraJSON is a fast JSON encoder and decoder written in pure C with bindings for Python 3.7+. Affected versions were found to improperly decode certain characters. JSON strings that contain escaped surrogate characters not part of a proper surrogate pair were decoded incorrectly. Besides corrupting strings, this allowed for potential key confusion and value overwriting in dictionaries. All users parsing JSON from untrusted sources are vulnerable. From version 5.4.0, UltraJSON decodes lone surrogates in the same way as the standard library's `json` module does, preserving them in the parsed output. Users are advised to upgrade. There are no known workarounds for this issue.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.5,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0199,"percentile":0.81274,"provenance":"source"},"cwes":[{"id":"CWE-670","name":"Always-Incorrect Control Flow Implementation"}],"references":[{"url":"https://github.com/ultrajson/ultrajson/security/advisories/GHSA-wpqr-jcpx-745r","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/ultrajson/ultrajson/commit/67ec07183342589d602e0fcf7bb1ff3e19272687","tags":["x_refsource_MISC"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OPPU5FZP3LCTXYORFH7NHUMYA5X66IA7/","tags":["vendor-advisory","x_refsource_FEDORA"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NAU5N4A7EUK2AMUCOLYDD5ARXAJYZBD2/","tags":["vendor-advisory","x_refsource_FEDORA"]}],"priority":{"score":21.5,"factors":[{"name":"EPSS percentile","points":16.25},{"name":"CVSS severity","points":5.25}]},"vendorSlug":"ultrajson","affectedVersions":[{"vendor":"ultrajson","product":"ultrajson","versions":["< 5.4.0"]}],"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"partial","timestamp":"2025-04-22T15:40:30.720341Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"ujson","vulnerableRanges":["<5.4.0"],"patched":["5.4.0"],"from":["GHSA-wpqr-jcpx-745r","PYSEC-2026-1057"],"provenance":"source"}],"summary":{"text":"UltraJSON, a fast C-based JSON encoder and decoder with Python 3.7+ bindings, incorrectly decodes JSON strings containing escaped surrogate characters that are not part of a proper surrogate pair, corrupting the parsed strings and enabling key confusion and value overwriting in dictionaries. An attacker can exploit this remotely over the network with no privileges or user interaction by supplying crafted JSON to any application that parses data from untrusted sources.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T06:46:57Z"},"euvd":{"id":"EUVD-2022-6438","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-ultrajson-cve-2022-31116","children":[{"from":"CVE-2022-31116","to":"CVE-2022-31117","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["lib/ultrajsondec.c"],"commits":["https://github.com/ultrajson/ultrajson/commit/67ec07183342589d602e0fcf7bb1ff3e19272687","https://github.com/ultrajson/ultrajson/commit/9c20de0f77b391093967e25d01fb48671104b15b"],"basis":"shared function","functions":["DecoderState"]}]}],"packageHistory":[{"cve":"CVE-2021-45958","published":"2021-12-31","fixed":"5.2.0","kev":false,"link":{"from":"CVE-2021-45958","to":"CVE-2022-31116","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:ujson","fromFixed":"5.2.0","toFixed":"5.4.0","daysApart":186}]}},{"cve":"CVE-2022-31116","published":"2022-07-05","fixed":"5.4.0","kev":false},{"cve":"CVE-2022-31117","published":"2022-07-05","fixed":"5.4.0","kev":false},{"cve":"CVE-2026-32874","published":"2026-03-20","fixed":"5.12.0","kev":false},{"cve":"CVE-2026-32875","published":"2026-03-20","fixed":"5.12.0","kev":false}],"package":"PyPI:ujson"}}