Incorrect handling of invalid surrogate pair characters in ujson
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- None · None · High
- Fix status
- Partial Red Hat: 2 fixed, 1 without a fix
Attack profile from CVSS 3.1 · CNA. Fix status from CNA, GitHub and Red Hat.
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- Yes
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| ultrajson | ultrajson | before 5.4.0 | 5.4.0 | Patch available | CNA |
| — | ujson (PyPI) | before 5.4.0 | 5.4.0 | Patch available | GHSA-wpqr-jcpx-745r |
- ultrajson Vendorultrajson Affected before 5.4.0 Fixed in 5.4.0 Patch available CNA
- ujson (PyPI) Vendor— Affected before 5.4.0 Fixed in 5.4.0 Patch available GHSA-wpqr-jcpx-745r
CPE configurations NVD · 3
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:ultrajson_project:ultrajson:*:*:*:*:*:python:*:* | before 5.4.0 | Vulnerable | ultrajson |
| cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* | 35 | Vulnerable | Fedoraproject |
| cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:* | 36 | Vulnerable | Fedoraproject |
- cpe:2.3:a:ultrajson_project:ultrajson:*:*:*:*:*:python:*:* Versions before 5.4.0 Vulnerable ·ultrajson
- cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* Versions 35 Vulnerable ·Fedoraproject
- cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:* Versions 36 Vulnerable ·Fedoraproject
Remediation
- Fix · CNA ultrajson (ultrajson) Fixed in 5.4.0
- Fix · GHSA-wpqr-jcpx-745r ujson (PyPI) Fixed in 5.4.0 Advisory →
Red Hat 2 advisories
- RHSA-2022:8864 Released 2022-12-07 · Red Hat rating ModerateRed Hat OpenStack Platform 16.1.9 (python-ujson) security update
- Red Hat OpenStack Platform 16.1 python-ujson-2.0.3-3.el8ost, python3-ujson-2.0.3-3.el8ost
- RHSA-2022:8850 Released 2022-12-07 · Red Hat rating ModerateRed Hat OpenStack Platform 16.2.4 (python-ujson) security update
- Red Hat OpenStack Platform 16.2 python-ujson-2.0.3-3.el8ost, python3-ujson-2.0.3-3.el8ost
Fixed in the same release
Records fixed by the same vendor advisory or release, as the CNA lists them.
- Advisory ·
ultrajson — FEDORA-2022-1b2b8d5177
2 records Highest priority Priority HIGH 1 HIGH, 1 LOW
Other records, highest priority first
- TI-2022-13161 Double free of buffer during string decoding in ujsonPriority LOW 30
Vendor assessments
Red Hat
Red Hat rating: Moderate. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Red Hat OpenStack Platform 13 (Queens) | Affected | No fix planned: Out of support scope |
| Red Hat OpenStack Platform 16.1 | Fixed | RHSA-2022:8864 |
| Red Hat OpenStack Platform 16.2 | Fixed | RHSA-2022:8850 |
Timeline
- 2026-10-02 Threatist record created from CVE-2022-31116
- 2026-10-03 Alias added: GHSA-wpqr-jcpx-745r
References
Advisory 3
More Ultrajson vulnerabilities
- TI-2026-32560 UltraJSON: Memory Leak in ujson.dump() on Write Failure CVSS 4.0HIGH 8.7
- TI-2026-25335 UltraJSON has an integer overflow handling large indent leads to buffer overflow or infinite loop CVSS 3.1HIGH 7.5
- TI-2026-25334 UltraJSON has a Memory Leak parsing large integers allows DoS CVSS 3.1HIGH 7.5
- TI-2026-39683 UltraJSON: Malformed/Truncated UTF-8 Accepted and Silently Rewritten in ujson.dumps() CVSS 3.1MEDIUM 6.5
- TI-2022-13161 Double free of buffer during string decoding in ujson CVSS 3.1MEDIUM 5.9
- TI-2021-20961 UltraJSON (aka ujson) through 5.1.0 has a stack-based buffer overflow in… CVSS 3.1MEDIUM 5.5
Sources
- CVE-2022-31116 · CVE Program
- CVE-2022-31116 · NVD
- FIRST EPSS
- GHSA-wpqr-jcpx-745r · GitHub Advisory Database · CC BY 4.0
- CVE-2022-31116 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences