CVE-2022-31117 Double free of buffer during string decoding in ujson
A double free vulnerability in UltraJSON's C-based decoder could allow attackers to cause denial of service or execute arbitrary code if triggered via internal mechanisms.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-31117?
CVE-2022-31117 is a medium-severity use after free vulnerability in Fedoraproject Fedora, published on 5 Jul 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official 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.
Weakness: CWE-415
Which versions are affected by CVE-2022-31117?
3 open source packages ship an affected version, including ujson. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
ujson PyPI | All versions | 5.4.0 |
ujson PyPI | All versions | 5.4.0 |
ujson PyPI | All versions | 5.4.0 |
Products include Fedoraproject Fedora, Ultrajson Project Ultrajson.
How do I fix CVE-2022-31117?
Upgrade ujson to 5.4.0 or later.
Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.
Is CVE-2022-31117 being exploited?
There is no known exploitation of CVE-2022-31117 in the wild and no public exploit code.
Other vulnerabilities in Fedoraproject Fedora
Sources
Also known as DEBIAN-CVE-2022-31117, GHSA-fm67-cv37-96ff, PYSEC-2026-1056, UBUNTU-CVE-2022-31117.