CVE-2022-23584: Tensorflow Use After Free Vulnerability
HIGHCVE-2022-23584 is a HIGH (CVSS 7.6) use after free vulnerability (CWE-416: Use After Free) affecting Tensorflow libraries in the PyPI ecosystem. The issue involves use after free in `decodepng` kernel. Remediation is available by upgrading affected packages to version 2.5.3, 2.6.3, 2.7.1.
CVE-2022-23584 at a Glance
Security Impact
CVSS: 7.6
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:L/I:L/A:H).
How to Fix CVE-2022-23584
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-23584, 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-416: Use After Free, where the product reuses or references memory after it has been freed. at some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer. 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-23584 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-23584?
Which Tensorflow versions are affected?
What version fixes CVE-2022-23584?
Is tensorflow affected?
Is tensorflow-cpu affected?
What is the CVSS score of CVE-2022-23584?
What CWE is associated with CVE-2022-23584?
How can I check PyPI dependencies for CVE-2022-23584?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-24x4-6qmh-88qg",
"modified" : "2024-11-07T22:28:38Z",
"published" : "2022-02-09T23:57:42Z",
"aliases" : [ "CVE-2022-23584" ],
"summary" : "Use after free in `DecodePng` kernel",
"details" : "### Impact\nA malicious user can cause a use after free behavior when [decoding PNG images](https://github.com/tensorflow/tensorflow/blob/a1320ec1eac186da1d03f033109191f715b2b130/tensorflow/core/kernels/image/decode_image_op.cc#L339-L346):\n```cc\nif (/* ... error conditions ... */) {\n png::CommonFreeDecode(&decode);\n OP_REQUIRES(context, false,\n errors::InvalidArgument(\"PNG size too large for int: \",\n decode.width, \" by \", decode.height));\n} \n```\nAfter `png::CommonFreeDecode(&decode)` gets called, the values of `decode.width` and `decode.height` are in an unspecified state.\n\n### Patches\nWe have patched the issue in GitHub commit [e746adbfcfee15e9cfdb391ff746c765b99bdf9b](https://github.com/tensorflow/tensorflow/commit/e746adbfcfee15e9cfdb391ff746c765b99bdf9b).\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:L/I:L/A:H"
} ],
"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-24x4-6qmh-88qg"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23584"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/commit/e746adbfcfee15e9cfdb391ff746c765b99bdf9b"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2022-93.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2022-148.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#L339-L346"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-416" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-02-04T19:37:12Z",
"nvd_published_at" : "2022-02-04T23:15:00Z"
}
}