CVE-2022-31117
JSON

5.9medium

Double free of buffer during string decoding in ujson

Severity
5.9medium CVSS:3.1 by GitHub_M
Exploit likelihood
1.88% (higher than 80% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-fm67-cv37-96ffPYSEC-2026-1056

Description

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.

Affected

Product or packageVersionsReported by
ultrajson ultrajson< 5.4.0CVE List
ujson (PyPI)before 5.4.0GitHub Advisory Database, PyPA Advisory Database
ultrajson_project ultrajsonbefore 5.4.0NVD
fedoraproject fedora35, 36NVD

All scores

GitHub_M5.9medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub5.9medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD5.9medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD4.3medium CVSS:2.0AV:N/AC:M/Au:N/C:N/I:N/A:P
PyPA Advisory Database5.9medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-415

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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.

GitHub Advisory Database
Impact

What kind of vulnerability is it? Who is impacted?

When an error occurs while reallocating the buffer for string decoding, the buffer gets freed twice.

Due to how UltraJSON uses the internal decoder, this double free is impossible to trigger from Python.

Patches

Has the problem been patched? What versions should users upgrade to?

Users should upgrade to UltraJSON 5.4.0.

Workarounds

Is there a way for users to fix or remediate the vulnerability without upgrading?

There is no workaround.

For more information

If you have any questions or comments about this advisory:

NVD (es)

UltraJSON es un codificador y decodificador JSON rápido escrito en C puro con enlaces para Python versiones 3.7+.&#xa0;En versiones anteriores a la 5.4.0, un error al reasignar un búfer para la decodificación de cadenas puede hacer que el búfer se libere dos veces.&#xa0;Debido a cómo UltraJSON usa el decodificador interno, esta doble liberación es imposible de activar desde Python.&#xa0;Este problema ha sido resuelto en la versión 5.4.0 y todos los usuarios deben actualizar a UltraJSON 5.4.0.&#xa0;No se conocen mitigaciones adicionales para este problema

References

https://github.com/ultrajson/ultrajson/security/advisories/GHSA-fm67-cv37-96ffthird-party-advisory, web
https://github.com/ultrajson/ultrajson/commit/9c20de0f77b391093967e25d01fb48671104b15bpatch, third-party-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OPPU5FZP3LCTXYORFH7NHUMYA5X66IA7/vendor-advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NAU5N4A7EUK2AMUCOLYDD5ARXAJYZBD2/vendor-advisory
https://nvd.nist.gov/vuln/detail/CVE-2022-31117advisory
https://github.com/ultrajson/ultrajsonpackage
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NAU5N4A7EUK2AMUCOLYDD5ARXAJYZBD2web
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OPPU5FZP3LCTXYORFH7NHUMYA5X66IA7web
https://pypi.org/project/ujsonpackage
https://github.com/advisories/GHSA-fm67-cv37-96ffadvisory

Sources

SourceRecordLicence
CVE ListCVE-2022-31117 changed 2025-04-23CVE Terms of Use
GitHub Advisory DatabaseGHSA-fm67-cv37-96ff changed 2026-07-07CC-BY-4.0
NVDCVE-2022-31117 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2026-1056 changed 2026-07-07CC-BY-4.0