Double free of buffer during string decoding in ujson
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- High
- Impact type
- Denial of service
- 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. Impact type from CWE-415 and the CVSS impact.
Summary
UltraJSON is a fast JSON encoder and decoder written in pure C with bindings for Python 3.7+. In versions prior to 5.4.0 an error occurring while reallocating a buffer for string decoding can cause the buffer to get freed twice. Due to how UltraJSON uses the internal decoder, this double free is impossible to trigger from Python. This issue has been resolved in version 5.4.0 and all users should upgrade to UltraJSON 5.4.0. There are no known workarounds for this issue.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- 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-fm67-cv37-96ff |
- 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-fm67-cv37-96ff
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-fm67-cv37-96ff 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-13160 Incorrect handling of invalid surrogate pair characters in ujsonPriority HIGH 72
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-31117
- 2026-10-03 Alias added: GHSA-fm67-cv37-96ff
References
Advisory 4
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-2022-13160 Incorrect handling of invalid surrogate pair characters in ujson 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-2021-20961 UltraJSON (aka ujson) through 5.1.0 has a stack-based buffer overflow in… CVSS 3.1MEDIUM 5.5
Sources
- CVE-2022-31117 · CVE Program
- CVE-2022-31117 · NVD
- FIRST EPSS
- GHSA-fm67-cv37-96ff · GitHub Advisory Database · CC BY 4.0
- CVE-2022-31117 · 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