CVE-2022-23585: Tensorflow Memory Leak Vulnerability
MODERATECVE-2022-23585 is a MODERATE (CVSS 4.3) memory leak vulnerability (CWE-401: Missing Release of Memory after Effective Lifetime) affecting Tensorflow libraries in the PyPI ecosystem. The issue involves memory leak in decoding png images. Remediation is available by upgrading affected packages to version 2.5.3, 2.6.3, 2.7.1.
CVE-2022-23585 at a Glance
Security Impact
CVSS: 4.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2022-23585
To remediate this vulnerability, upgrade all affected Tensorflow 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 tensorflow>=2.5.3
pip install tensorflow>=2.6.3
pip install tensorflow>=2.7.1
pip install tensorflow-cpu>=2.5.3
pip install tensorflow-cpu>=2.6.3
pip install tensorflow-cpu>=2.7.1
pip install tensorflow-gpu>=2.5.3
pip install tensorflow-gpu>=2.6.3
pip install tensorflow-gpu>=2.7.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show tensorflow
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2022-23585, inspect your installed packages using pip:
pip show tensorflow
Analyze the terminal output to locate any version of Tensorflow in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.5.3), your application is affected.
Note: The pip show tensorflow command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-401: Missing Release of Memory after Effective Lifetime, where the product does not sufficiently track and release allocated memory after it has been used, making the memory unavailable for reallocation and reuse. In Tensorflow, 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-23585 Affected Tensorflow Versions
9 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
tensorflow
|
PyPI |
< 2.5.3
|
2.5.3
|
|
tensorflow
|
PyPI |
≥ 2.6.0
< 2.6.3
|
2.6.3
|
|
tensorflow
|
PyPI |
≥ 2.7.0
< 2.7.1
All 1 versions
2.7.0
|
2.7.1
|
|
tensorflow-cpu
|
PyPI |
< 2.5.3
|
2.5.3
|
|
tensorflow-cpu
|
PyPI |
≥ 2.6.0
< 2.6.3
|
2.6.3
|
|
tensorflow-cpu
|
PyPI |
≥ 2.7.0
< 2.7.1
All 1 versions
2.7.0
|
2.7.1
|
|
tensorflow-gpu
|
PyPI |
< 2.5.3
|
2.5.3
|
|
tensorflow-gpu
|
PyPI |
≥ 2.6.0
< 2.6.3
|
2.6.3
|
|
tensorflow-gpu
|
PyPI |
≥ 2.7.0
< 2.7.1
All 1 versions
2.7.0
|
2.7.1
|
References
Frequently Asked Questions
What is CVE-2022-23585?
Which Tensorflow versions are affected?
What version fixes CVE-2022-23585?
Is tensorflow affected?
Is tensorflow-cpu affected?
What is the CVSS score of CVE-2022-23585?
What CWE is associated with CVE-2022-23585?
How can I check PyPI dependencies for CVE-2022-23585?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-fq6p-6334-8gr4",
"modified" : "2024-11-07T22:28:59Z",
"published" : "2022-02-09T23:26:08Z",
"aliases" : [ "CVE-2022-23585" ],
"summary" : "Memory leak in decoding PNG images",
"details" : "### Impact\nWhen [decoding PNG images](https://github.com/tensorflow/tensorflow/blob/a1320ec1eac186da1d03f033109191f715b2b130/tensorflow/core/kernels/image/decode_image_op.cc#L322-L416) TensorFlow can produce a memory leak if the image is invalid.\nAfter calling `png::CommonInitDecode(..., &decode)`, the `decode` value contains allocated buffers which can only be freed by calling `png::CommonFreeDecode(&decode)`. However, several error case in the function implementation invoke the `OP_REQUIRES` macro which immediately terminates the execution of the function, without allowing for the memory free to occur.\n \n### Patches \nWe have patched the issue in GitHub commit [ab51e5b813573dc9f51efa335aebcf2994125ee9](https://github.com/tensorflow/tensorflow/commit/ab51e5b813573dc9f51efa335aebcf2994125ee9).\n\nThe fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.\n\n### For more information\nPlease consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.5.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.6.0"
}, {
"fixed" : "2.6.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.7.0"
}, {
"fixed" : "2.7.1"
} ]
} ],
"versions" : [ "2.7.0" ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.5.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.6.0"
}, {
"fixed" : "2.6.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.7.0"
}, {
"fixed" : "2.7.1"
} ]
} ],
"versions" : [ "2.7.0" ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.5.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.6.0"
}, {
"fixed" : "2.6.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.7.0"
}, {
"fixed" : "2.7.1"
} ]
} ],
"versions" : [ "2.7.0" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-fq6p-6334-8gr4"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23585"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/commit/ab51e5b813573dc9f51efa335aebcf2994125ee9"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2022-94.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2022-149.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/blob/a1320ec1eac186da1d03f033109191f715b2b130/tensorflow/core/kernels/image/decode_image_op.cc#L322-L416"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-401" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-02-04T19:09:09Z",
"nvd_published_at" : "2022-02-04T23:15:00Z"
}
}