CVE-2022-31116 json
Incorrect handling of invalid surrogate pair characters in ujson
published 2022-07-05 4 y ago modified 2026-07-07 4 mo ago also GHSA-wpqr-jcpx-745r , PYSEC-2026-1057 , EUVD-2022-6438
- cvss
- 7.5
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 2.5%
- EPSS 2.5% chance of exploitation in 30 days, percentile 85%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- pypi ujson 5.4.0
- ultrajson_project ultrajson 5.4.0
- ujson Debian 14, Debian 13, Debian 12 5.4.0-1
debian advisories DEBIAN-CVE-2022-31116
- ujson Ubuntu Pro 16.04 LTS 1.33-1ubuntu0.1~esm2
- ujson Ubuntu Pro 18.04 LTS 1.35-2ubuntu0.1~esm1
- ujson Ubuntu Pro 22.04 LTS 5.1.0-1ubuntu0.1~esm1
ubuntu advisories UBUNTU-CVE-2022-31116
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- python-ujson openstack 16.2, openstack 16.1 2.0.3-3.el8ost
- python3-ujson openstack 16.2, openstack 16.1 2.0.3-3.el8ost
red hat advisories RHSA-2022:8864RHSA-2022:8850
- python-ujson SLE Module for Package Hub 15 SP4, SLE Module for Package Hub 15 SP3, SLE Module for Development Tools 15 SP4 +3 more 1.35-150100.3.5.1
suse advisories SUSE-SU-2022:2673-1
- python-ujson openSUSE Tumbleweed 5.10.0-1.5
opensuse advisories openSUSE-SU-2025:15107-1
- py3-ujson Alpine 3.24, Alpine 3.23, Alpine 3.22 +6 more 5.4.0-r0
alpine advisories ALPINE-CVE-2022-31116
Alpine secdb © Alpine Linux, from https://secdb.alpinelinux.org via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2022-31116 updated cvss 7.5
python-ujson: improper decoding of escaped surrogate characters may lead to string corruption, key confusion or value overwriting
-
Red Hat OpenStack Platform 13 (Queens) python-ujsonaffected: no fix planned “Out of support scope”
-
Red Hat OpenStack Platform 16.1 python-ujson 2.0.3-3.el8ost, python3-ujson 2.0.3-3.el8ostfixed: vendor fix RHSA-2022:8864
-
Red Hat OpenStack Platform 16.2 python-ujson 2.0.3-3.el8ost, python3-ujson 2.0.3-3.el8ostfixed: vendor fix RHSA-2022:8850
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- Proof of concept is public
- Automatable
- yes
- Technical impact
- partial
- Assessed
- 18 mo ago
Exploit prediction
2.54% chance of exploitation in the next 30 days, higher than 85% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- github.com https://github.com/ultrajson/ultrajson/security/advisories/GHSA-wpqr-jcpx-745r referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | 3.1 | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | 2.0 | 5.0 | AV:N/AC:L/Au:N/C:N/I:N/A:P |
| GitHub | 3.1 | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| OSV | 3.1 | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | ujson | <5.4.0 |
5.4.0 |
Affected products
- ultrajson ultrajson
Classification
- Weakness
-
- CWE-670 Always-Incorrect Control Flow Implementation
References
-
github.com
/ultrajson/ultrajson/commit/67ec07183342589d602e0fcf7bb1ff3e19272687
web, patch, third-party-advisory
-
github.com
/ultrajson/ultrajson/security/advisories/GHSA-wpqr-jcpx-745r
web, exploit, third-party-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/OPPU5FZP3LCTXYORFH7NHUMYA5X66IA7/
vendor-advisory
-
lists.fedoraproject.org
/archives/list/package-announce%40lists.fedoraproject.org/message/NAU5N4A7EUK2AMUCOLYDD5ARXAJYZBD2/
vendor-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2022-31116
advisory
-
github.com
/ultrajson/ultrajson
package
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/NAU5N4A7EUK2AMUCOLYDD5ARXAJYZBD2
web
-
lists.fedoraproject.org
/archives/list/package-announce@lists.fedoraproject.org/message/OPPU5FZP3LCTXYORFH7NHUMYA5X66IA7
web
-
pypi.org
/project/ujson
package
-
github.com
/advisories/GHSA-wpqr-jcpx-745r
advisory
Sources
- CVE List CVE-2022-31116
- GitHub Advisory GHSA-wpqr-jcpx-745r
- NVD CVE-2022-31116
- OSV PYSEC-2026-1057
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.