Double Free Vulnerability in UltraJSON (ujson) Prior to Version 5.4.0

ujson Updated 02 Oct 2025

Summary

05/07/2022
N/A
No i
Medium
5.9

CVE-2022-31117: UltraJSON is a fast JSON encoder and decoder written in pure C with bindings for Python 3.7+. Affects ujson versions < 9c20de0f77b391093967e25d01fb48671104b15b. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

UltraJSON, also known as ujson, is a high-performance JSON encoder and decoder implemented in pure C, designed for Python 3.7 and later. It is widely used for its speed and efficiency in handling JSON data, making it a popular choice among developers. However, certain versions of ujson prior to 5.4.0 contain a critical vulnerability that can lead to memory management issues.

Vulnerability Detail

The vulnerability arises from an error during the reallocation of a buffer used for string decoding, which can result in the buffer being freed twice. This double free condition is a serious memory management flaw that, while not easily triggered from Python due to the internal workings of UltraJSON's decoder, could potentially lead to application crashes or unexpected behavior if exploited in other contexts.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

There are no known workarounds for this issue. The only effective solution is to upgrade to the fixed version.

Conclusion

The UltraJSON vulnerability (CVE-2022-31117) poses a significant risk due to a double free error in memory management. Users are strongly advised to upgrade to version 5.4.0 or later to mitigate this risk. Regular monitoring and vulnerability management practices, such as using tools like Vulert, can help maintain application security.

See every vulnerability recorded for ujson →

Share this vulnerability

FAQ

The CVSS score for this vulnerability is 5.9, indicating a medium severity level.

All versions of UltraJSON prior to 5.4.0 are affected by this vulnerability.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Yes, after upgrading to version 5.4.0 or later, the vulnerability is resolved, and it is safe to use UltraJSON.

If an immediate upgrade is not possible, monitor your application closely for any unusual behavior, but be aware that there are no workarounds for this vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for ujson.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback