CVE-2023-25399
Description
A disputed memory leak in SciPy's Py_FindObjects function due to unreleased reference count, but SciPy is not designed for untrusted input.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A disputed memory leak in SciPy's Py_FindObjects function due to unreleased reference count, but SciPy is not designed for untrusted input.
Vulnerability
Overview
CVE-2023-25399 describes a refcounting issue in SciPy, discovered in commit 8627df31ab, in the Py_FindObjects() function. The root cause is that a new reference to a Python object is created but not properly decreased, leading to a potential memory leak over repeated calls. The issue was originally reported through a static analyzer. [1]
Exploitation
Context
To trigger this memory leak, an attacker would need to call the affected function with crafted inputs. However, the official SciPy project disputes this as a security vulnerability, stating that SciPy is not designed to be exposed to untrusted users or data directly. The project's threat model does not consider such memory leaks as exploitable in typical usage scenarios, as they only result in gradual memory exhaustion under specific conditions. [1][4]
Impact
The primary impact is a gradual memory leak, which could, in theory, lead to denial of service through memory exhaustion if the function is called repeatedly with appropriate arguments. No other security implications, such as code execution or privilege escalation, have been identified. The issue is considered a bug rather than a vulnerability by the maintainers. [1]
Mitigation
Status
As the finding is disputed, no official patch has been released specifically for this issue. Users who rely on SciPy for processing untrusted data should take precautions, such as running it in a sandboxed environment. The PyPA advisory database does not list a severity score. [3]
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
scipyPyPI | < 1.10.0 | 1.10.0 |
Affected products
13- scipy/scipydescription
- ghsa-coords12 versionspkg:pypi/scipypkg:rpm/opensuse/python-scipy_1_2_0-gnu-hpc&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/python-scipy_1_2_0-gnu-hpc&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/python-scipy_1_3_3-gnu-hpc&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/python-scipy_1_3_3-gnu-hpc&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/python-scipy&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/python-scipy&distro=openSUSE%20Leap%2015.5pkg:rpm/suse/python-scipy_1_3_3-gnu-hpc&distro=SUSE%20Linux%20Enterprise%20Module%20for%20HPC%2015%20SP4pkg:rpm/suse/python-scipy_1_3_3-gnu-hpc&distro=SUSE%20Linux%20Enterprise%20Module%20for%20HPC%2015%20SP5pkg:rpm/suse/python-scipy_1_3_3-gnu-hpc&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Package%20Hub%2015%20SP5pkg:rpm/suse/python-scipy&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Package%20Hub%2015%20SP4pkg:rpm/suse/python-scipy&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Package%20Hub%2015%20SP5
< 1.10.0+ 11 more
- (no CPE)range: < 1.10.0
- (no CPE)range: < 1.2.0-150100.4.6.1
- (no CPE)range: < 1.2.0-150100.4.6.1
- (no CPE)range: < 1.3.3-150200.5.3.1
- (no CPE)range: < 1.3.3-150200.5.3.1
- (no CPE)range: < 1.2.0-150100.4.6.1
- (no CPE)range: < 1.3.3-150200.5.3.1
- (no CPE)range: < 1.3.3-150200.5.3.1
- (no CPE)range: < 1.3.3-150200.5.3.1
- (no CPE)range: < 1.3.3-150200.5.3.1
- (no CPE)range: < 1.3.3-150200.5.3.1
- (no CPE)range: < 1.3.3-150200.5.3.1
Patches
19b6521198c4fBUG: fix a minor refcounting issue in `Py_FindObjects`
1 file changed · +3 −3
scipy/ndimage/src/nd_image.c+3 −3 modified@@ -885,7 +885,7 @@ static PyObject *Py_FindObjects(PyObject *obj, PyObject *args) npy_intp idx = PyArray_NDIM(input) > 0 ? 2 * PyArray_NDIM(input) * ii : ii; if (regions[idx] >= 0) { - PyObject *tuple = PyTuple_New(PyArray_NDIM(input)); + tuple = PyTuple_New(PyArray_NDIM(input)); if (!tuple) { PyErr_NoMemory(); goto exit; @@ -903,8 +903,8 @@ static PyObject *Py_FindObjects(PyObject *obj, PyObject *args) PyErr_NoMemory(); goto exit; } - Py_XDECREF(start); - Py_XDECREF(end); + Py_DECREF(start); + Py_DECREF(end); start = end = NULL; PyTuple_SetItem(tuple, jj, slc); slc = NULL;
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
9- github.com/advisories/GHSA-9jx5-6pgf-crrpghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2023-25399ghsaADVISORY
- www.square16.org/achievement/cve-2023-25399ghsaWEB
- github.com/pypa/advisory-database/tree/main/vulns/scipy/PYSEC-2023-102.yamlghsaWEB
- github.com/scipy/scipy/commit/9b6521198c4f31d3f9cb525e581bea8e3e77f0a2ghsaWEB
- github.com/scipy/scipy/issues/16235ghsaWEB
- github.com/scipy/scipy/issues/16235ghsaWEB
- github.com/scipy/scipy/pull/16397ghsaWEB
- www.square16.org/achievement/cve-2023-25399/mitre
News mentions
0No linked articles in our index yet.