CVE-2022-31117: Ujson Potential Double Free Of Buffer Vulnerability
MODERATECVE-2022-31117 is a MODERATE (CVSS 5.9) potential double free of buffer vulnerability (CWE-415: Double Free) affecting Ujson libraries in the PyPI ecosystem. The issue involves potential double free of buffer during string decoding. Remediation is available by upgrading affected packages to version 5.4.0.
CVE-2022-31117 at a Glance
Security Impact
CVSS: 5.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2022-31117
To remediate this vulnerability, upgrade all affected Ujson dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install ujson>=5.4.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show ujson
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2022-31117, inspect your installed packages using pip:
pip show ujson
Analyze the terminal output to locate any version of Ujson in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.4.0), your application is affected.
Note: The pip show ujson command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-415: Double Free, where the product calls free() twice on the same memory address. In Ujson, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-31117 Affected Ujson Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ujson
|
PyPI |
< 5.4.0
|
5.4.0
|
References
Frequently Asked Questions
What is CVE-2022-31117?
Which Ujson versions are affected?
What version fixes CVE-2022-31117?
Is ujson affected?
What is the CVSS score of CVE-2022-31117?
What CWE is associated with CVE-2022-31117?
How can I check PyPI dependencies for CVE-2022-31117?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-fm67-cv37-96ff",
"modified" : "2022-07-15T20:48:04Z",
"published" : "2022-07-05T21:05:59Z",
"aliases" : [ "CVE-2022-31117" ],
"summary" : "Potential double free of buffer during string decoding",
"details" : "### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nWhen an error occurs while reallocating the buffer for string decoding, the buffer gets freed twice.\n\nDue to how UltraJSON uses the internal decoder, this double free is impossible to trigger from Python.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\nUsers should upgrade to UltraJSON 5.4.0.\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nThere is no workaround.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [UltraJSON](http://github.com/ultrajson/ultrajson/issues)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "ujson"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.4.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/ultrajson/ultrajson/security/advisories/GHSA-fm67-cv37-96ff"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31117"
}, {
"type" : "WEB",
"url" : "https://github.com/ultrajson/ultrajson/commit/9c20de0f77b391093967e25d01fb48671104b15b"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/ultrajson/ultrajson"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NAU5N4A7EUK2AMUCOLYDD5ARXAJYZBD2"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OPPU5FZP3LCTXYORFH7NHUMYA5X66IA7"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-415" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-07-05T21:05:59Z",
"nvd_published_at" : "2022-07-05T18:15:00Z"
}
}