CVE-2023-37365: Hnswlib Hnswlib Double Free Vulnerability Vulnerability
MODERATECVE-2023-37365 is a MODERATE (CVSS 6.5) hnswlib double free vulnerability vulnerability (CWE-415: Double Free) affecting Hnswlib libraries in the PyPI ecosystem. The issue involves hnswlib double free vulnerability. Remediation is available by upgrading affected packages to version 0.8.0.
CVE-2023-37365 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H).
How to Fix CVE-2023-37365
To remediate this vulnerability, upgrade all affected Hnswlib 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 hnswlib>=0.8.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show hnswlib
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2023-37365, inspect your installed packages using pip:
pip show hnswlib
Analyze the terminal output to locate any version of Hnswlib in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.8.0), your application is affected.
Note: The pip show hnswlib 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 Hnswlib, 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-2023-37365 Affected Hnswlib Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
hnswlib
|
PyPI |
< 0.8.0
|
0.8.0
|
References
Frequently Asked Questions
What is CVE-2023-37365?
Which Hnswlib versions are affected?
What version fixes CVE-2023-37365?
Is hnswlib affected?
What is the CVSS score of CVE-2023-37365?
What CWE is associated with CVE-2023-37365?
How can I check PyPI dependencies for CVE-2023-37365?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xwc8-rf6m-xr86",
"modified" : "2026-03-25T15:04:47Z",
"published" : "2023-06-30T21:30:26Z",
"aliases" : [ "CVE-2023-37365" ],
"summary" : "hnswlib Double Free vulnerability",
"details" : "Hnswlib 0.7.0 has a double free in `init_index` when the M argument is a large integer.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "hnswlib"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.8.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-37365"
}, {
"type" : "WEB",
"url" : "https://github.com/nmslib/hnswlib/issues/467"
}, {
"type" : "WEB",
"url" : "https://github.com/nmslib/hnswlib/pull/484"
}, {
"type" : "WEB",
"url" : "https://github.com/nmslib/hnswlib/commit/f6d170ce0b41f9e75ace473b09df6e7872590757"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/nmslib/hnswlib"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-415" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-06-30T22:12:53Z",
"nvd_published_at" : "2023-06-30T19:15:09Z"
}
}