CVE-2022-31117: ujson - Potential Double Free of Buffer During String Decoding

ujson Updated 07 Jul 2026

Summary

06/07/2026
Yes i
Moderate
5.9

CVE-2022-31117: Potential double free of buffer during string decoding. Affects ujson versions < 5.4.0. Fixed in 5.4.0. How to fix ↓

Also tracked for

The same CVE-2022-31117 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

UltraJSON, commonly referred to as ujson, is a high-performance JSON encoding and decoding library for Python. It is designed to provide faster processing of JSON data compared to the standard library's json module. ujson is widely used in applications that require efficient data interchange, making it a critical component in many Python projects. However, like any software, it is not immune to vulnerabilities, which can affect its reliability and security.

Vulnerability Detail

The vulnerability identified as CVE-2022-31117 involves a potential double free of a buffer during the string decoding process in the ujson library. This issue arises when an error occurs while reallocating the buffer, leading to the buffer being freed twice. Although the internal workings of UltraJSON make it difficult to trigger this double free from Python, it still poses a risk in certain scenarios, potentially leading to memory corruption or application crashes.

How To Fix

Latest published version: 6.0.0 as of 23 Oct 2026

pip install --upgrade "ujson==6.0.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.4.0

This is the first release that contains the fix.

pip install --upgrade "ujson==5.4.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There are no workarounds available for this vulnerability. The only solution is to upgrade to the patched version of the library.

Conclusion

CVE-2022-31117 is a significant vulnerability in the ujson library that can lead to a double free of a buffer during string decoding. Users are strongly advised to upgrade to version 5.4.0 or later to ensure their applications remain secure. Regular monitoring for vulnerabilities using tools like Vulert can also help maintain the integrity of your software.

See every vulnerability recorded for ujson →

Share this vulnerability

FAQ

CVE-2022-31117 is a vulnerability in the ujson library that can lead to a double free of a buffer during string decoding.

While the vulnerability is difficult to trigger from Python, it can still lead to memory corruption or crashes in applications using the affected version of ujson.

You should upgrade to UltraJSON version 5.4.0 or later to mitigate the risk associated with this vulnerability.

Yes, you can use Vulert to monitor and alert in real-time for open-source vulnerabilities in your software. You can check your application against this vulnerability using the Vulert playground without any signup.

The CVSS score for CVE-2022-31117 is 5.9, indicating a moderate level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for ujson.

How To Fix

Latest published version: 6.0.0 as of 23 Oct 2026

pip install --upgrade "ujson==6.0.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.4.0

This is the first release that contains the fix.

pip install --upgrade "ujson==5.4.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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