Vulnerability · Published Jul 5, 2022 · Assigned by GitHub_M
CVE-2022-31116Incorrect handling of invalid surrogate pair characters in ujson
High 7.5
In plain English
A high-severity security flaw in ultrajson from ultrajson. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 2.5% (higher than 85% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
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.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine:v3.20 | py3-ujson | 5.4.0-r0 | ALPINE-CVE-2022-31116 |
| Alpine:v3.21 | py3-ujson | 5.4.0-r0 | ALPINE-CVE-2022-31116 |
| Alpine:v3.22 | py3-ujson | 5.4.0-r0 | ALPINE-CVE-2022-31116 |
| Alpine:v3.23 | py3-ujson | 5.4.0-r0 | ALPINE-CVE-2022-31116 |
| Alpine:v3.24 | py3-ujson | 5.4.0-r0 | ALPINE-CVE-2022-31116 |
| Debian:12 | ujson | 5.4.0-1 | DEBIAN-CVE-2022-31116 |
| Debian:13 | ujson | 5.4.0-1 | DEBIAN-CVE-2022-31116 |
| Debian:14 | ujson | 5.4.0-1 | DEBIAN-CVE-2022-31116 |
| PyPI | ujson | 5.4.0 | PYSEC-2026-1057 |
| PyPI | ujson | 5.4.0 | GHSA-wpqr-jcpx-745r |
| Ubuntu:22.04:LTS | collada2gltf | no fix listed | UBUNTU-CVE-2022-31116 |
| Ubuntu:22.04:LTS | pandas | no fix listed | UBUNTU-CVE-2022-31116 |
| Ubuntu:24.04:LTS | pandas | no fix listed | UBUNTU-CVE-2022-31116 |
| Ubuntu:25.10 | pandas | no fix listed | UBUNTU-CVE-2022-31116 |
| Ubuntu:26.04:LTS | pandas | no fix listed | UBUNTU-CVE-2022-31116 |
| Ubuntu:26.10 | pandas | no fix listed | UBUNTU-CVE-2022-31116 |
Affected products (as reported)
Weakness: CWE-670 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
References
- https://github.com/ultrajson/ultrajson/security/advisories/GHSA-wpqr-jcpx-745r x_refsource_CONFIRM
- https://github.com/ultrajson/ultrajson/commit/67ec07183342589d602e0fcf7bb1ff3e19272687 x_refsource_MISC
- FEDORA-2022-1b2b8d5177 vendor-advisory, x_refsource_FEDORA
- FEDORA-2022-33e816bc37 vendor-advisory, x_refsource_FEDORA