CVE-2022-23585: TensorFlow: memory leak in PNG decode causes DoS
MEDIUM PoC AVAILABLE CISA: TRACK*Authenticated users can crash TensorFlow image processing services by submitting malformed PNG files, exhausting memory without cleanup. If you expose TensorFlow-based image inference endpoints—CV models, image classifiers, multimodal pipelines—to any authenticated user or internal service, patch immediately to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3. No workaround exists short of input validation that rejects malformed PNGs before they reach the decoder.
What is the risk?
Medium severity in isolation, but operationally significant for production ML serving. Low attack complexity and only low privileges required means any authenticated API user—or a compromised internal service account—can trigger it repeatedly to degrade or crash an inference node. The absence of CISA KEV listing and no active exploitation evidence keeps this out of critical tier, but unpatched TF deployments processing untrusted image inputs face real DoS risk in multi-tenant or externally-accessible environments.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| TensorFlow | pip | — | No patch |
Do you use TensorFlow? You're affected.
How severe is it?
What is the attack surface?
What should I do?
5 steps-
PATCH
Upgrade to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3 — the fix is cherry-picked across all supported branches.
-
VALIDATE INPUTS
Implement upstream PNG validation (e.g., Pillow's verify() or libpng header checks) before passing images to TensorFlow decoders.
-
RESOURCE LIMITS
Apply memory limits and OOM kill policies to TF Serving containers/pods so a leak crash is bounded and auto-restarts.
-
RATE LIMIT
Throttle authenticated image submission endpoints to slow exhaustion attacks.
-
MONITOR
Alert on abnormal memory growth in TF serving processes — this leak is detectable via standard container memory metrics.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2022-23585?
Authenticated users can crash TensorFlow image processing services by submitting malformed PNG files, exhausting memory without cleanup. If you expose TensorFlow-based image inference endpoints—CV models, image classifiers, multimodal pipelines—to any authenticated user or internal service, patch immediately to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3. No workaround exists short of input validation that rejects malformed PNGs before they reach the decoder.
Is CVE-2022-23585 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-23585, increasing the risk of exploitation.
How to fix CVE-2022-23585?
1. PATCH: Upgrade to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3 — the fix is cherry-picked across all supported branches. 2. VALIDATE INPUTS: Implement upstream PNG validation (e.g., Pillow's verify() or libpng header checks) before passing images to TensorFlow decoders. 3. RESOURCE LIMITS: Apply memory limits and OOM kill policies to TF Serving containers/pods so a leak crash is bounded and auto-restarts. 4. RATE LIMIT: Throttle authenticated image submission endpoints to slow exhaustion attacks. 5. MONITOR: Alert on abnormal memory growth in TF serving processes — this leak is detectable via standard container memory metrics.
What systems are affected by CVE-2022-23585?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference APIs, image processing pipelines.
What is the CVSS score for CVE-2022-23585?
CVE-2022-23585 has a CVSS v3.1 base score of 6.5 (MEDIUM). The EPSS exploitation probability is 0.93%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0029 Denial of AI Service AML.T0034 Cost Harvesting AML.T0049 Exploit Public-Facing Application Compliance Controls Affected
What are the technical details?
Original Advisory
Tensorflow is an Open Source Machine Learning Framework. When decoding PNG images TensorFlow can produce a memory leak if the image is invalid. After 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. The 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.
Exploitation Scenario
An adversary with low-privilege API access to a computer vision inference service (e.g., an image classification endpoint used for product moderation or medical imaging) crafts a batch of syntactically invalid PNG files — malformed IHDR chunks or truncated image data that passes basic size checks but fails internal TensorFlow decode validation. They submit these in rapid succession via the API. Each request triggers the memory leak in `decode_image_op.cc` without cleanup. Over minutes to hours, the TF Serving instance exhausts available memory, causing OOM crashes. In a Kubernetes environment without proper restart limits, this creates a degradation-of-service loop. In training pipeline context, an adversary with write access to a shared training dataset store poisons it with invalid PNGs, causing training jobs to crash and forcing costly re-runs.
Weaknesses (CWE)
CWE-401 — Missing Release of Memory after Effective Lifetime: The product does not sufficiently track and release allocated memory after it has been used, making the memory unavailable for reallocation and reuse.
- [Implementation] Choose a language or tool that provides automatic memory management, or makes manual memory management less error-prone. For example, glibc in Linux provides protection against free of invalid pointers. When using Xcode to target OS X or iOS, enable automatic reference counting (ARC) [REF-391]. To help correctly and consistently manage memory when programming in C++, consider using a smart pointer class such as std::auto_ptr (defined by ISO/IEC ISO/IEC 14882:2003), std::shared_ptr and std::unique_ptr (specified by an upcoming revision of the C++ standard, informally referred to as C++ 1x), or equivalent solutions such as Boost.
- [Architecture and Design] Use an abstraction library to abstract away risky APIs. Not a complete solution.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H References
- github.com/tensorflow/tensorflow/blob/a1320ec1eac186da1d03f033109191f715b2b130/tensorflow/core/kernels/image/decode_image_op.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/ab51e5b813573dc9f51efa335aebcf2994125ee9 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-fq6p-6334-8gr4 Patch 3rd Party
Timeline
Related Vulnerabilities
CVE-2020-15196 9.9 TensorFlow: heap OOB read in sparse/ragged count ops
Same package: tensorflow CVE-2020-15205 9.8 TensorFlow: heap overflow in StringNGrams, ASLR bypass
Same package: tensorflow CVE-2020-15208 9.8 TFLite: OOB read/write via tensor dimension mismatch
Same package: tensorflow CVE-2019-16778 9.8 TensorFlow: heap overflow in UnsortedSegmentSum op
Same package: tensorflow CVE-2022-23587 9.8 TensorFlow: integer overflow in Grappler enables RCE
Same package: tensorflow