Staging Environment: Content and features may be unstable or change without notice.
Search for packages
Package details: pkg:pypi/keras@2.8.0
purl pkg:pypi/keras@2.8.0
Next non-vulnerable version 3.13.2
Latest non-vulnerable version 3.13.2
Risk 4.5
Vulnerabilities affecting this package (9)
Vulnerability Summary Fixed by
VCID-1wpv-agrc-7ydb
Aliases:
CVE-2025-9906
GHSA-36fq-jgmw-4r9c
PYSEC-2025-76
The Keras Model.load_model method can be exploited to achieve arbitrary code execution, even with safe_mode=True. One can create a specially crafted .keras model archive that, when loaded via Model.load_model, will trigger arbitrary code to be executed. This is achieved by crafting a special config.json (a file within the .keras archive) that will invoke keras.config.enable_unsafe_deserialization() to disable safe mode. Once safe mode is disable, one can use the Lambda layer feature of keras, which allows arbitrary Python code in the form of pickled code. Both can appear in the same archive. Simply the keras.config.enable_unsafe_deserialization() needs to appear first in the archive and the Lambda with arbitrary code needs to be second.
3.11.0
Affected by 11 other vulnerabilities.
VCID-2331-v9sq-4qb9
Aliases:
CVE-2025-12060
GHSA-hjqc-jx6g-rwp9
The keras.utils.get_file API in Keras, when used with the extract=True option for tar archives, is vulnerable to a path traversal attack. The utility uses Python's tarfile.extractall function without the filter="data" feature. A remote attacker can craft a malicious tar archive containing special symlinks, which, when extracted, allows them to write arbitrary files to any location on the filesystem outside of the intended destination folder. This vulnerability is linked to the underlying Python tarfile weakness, identified as CVE-2025-4517. Note that upgrading Python to one of the versions that fix CVE-2025-4517 (e.g. Python 3.13.4) is not enough. One additionally needs to upgrade Keras to a version with the fix (Keras 3.12).
3.12.0
Affected by 4 other vulnerabilities.
VCID-4q7c-unxm-5qaz
Aliases:
CVE-2025-12058
GHSA-mq84-hjqx-cwf2
The Keras.Model.load_model method, including when executed with the intended security mitigation safe_mode=True, is vulnerable to arbitrary local file loading and Server-Side Request Forgery (SSRF). This vulnerability stems from the way the StringLookup layer is handled during model loading from a specially crafted .keras archive. The constructor for the StringLookup layer accepts a vocabulary argument that can specify a local file path or a remote file path. * Arbitrary Local File Read: An attacker can create a malicious .keras file that embeds a local path in the StringLookup layer's configuration. When the model is loaded, Keras will attempt to read the content of the specified local file and incorporate it into the model state (e.g., retrievable via get_vocabulary()), allowing an attacker to read arbitrary local files on the hosting system. * Server-Side Request Forgery (SSRF): Keras utilizes tf.io.gfile for file operations. Since tf.io.gfile supports remote filesystem handlers (such as GCS and HDFS) and HTTP/HTTPS protocols, the same mechanism can be leveraged to fetch content from arbitrary network endpoints on the server's behalf, resulting in an SSRF condition. The security issue is that the feature allowing external path loading was not properly restricted by the safe_mode=True flag, which was intended to prevent such unintended data access.
3.12.0
Affected by 4 other vulnerabilities.
VCID-fpk2-6qn4-auem
Aliases:
CVE-2025-12638
GHSA-9g7v-8wxv-mwxp
Keras version 3.11.3 is affected by a path traversal vulnerability in the keras.utils.get_file() function when extracting tar archives. The vulnerability arises because the function uses Python's tarfile.extractall() method without the security-critical filter='data' parameter. Although Keras attempts to filter unsafe paths using filter_safe_paths(), this filtering occurs before extraction, and a PATH_MAX symlink resolution bug triggers during extraction. This bug causes symlink resolution to fail due to path length limits, resulting in a security bypass that allows files to be written outside the intended extraction directory. This can lead to arbitrary file writes outside the cache directory, enabling potential system compromise or malicious code execution. The vulnerability affects Keras installations that process tar archives with get_file() and does not affect versions where this extraction method is secured with the appropriate filter parameter.
3.12.0
Affected by 4 other vulnerabilities.
VCID-hnzb-7u2f-3ba5
Aliases:
GHSA-5478-v2w6-c6q7
Duplicate Advisory: Keras arbitrary code execution vulnerability # Duplicate Advisory This advisory has been withdrawn because it is a duplicate of GHSA-48g7-3x6r-xfhp. This link is maintained to preserve external references. # Original Description The Keras Model.load_model function permits arbitrary code execution, even with safe_mode=True, through a manually constructed, malicious .keras archive. By altering the config.json file within the archive, an attacker can specify arbitrary Python modules and functions, along with their arguments, to be loaded and executed during model loading.
3.9.0
Affected by 13 other vulnerabilities.
VCID-n61b-6n8p-dbgk
Aliases:
CVE-2024-55459
GHSA-cjgq-5qmw-rcj6
PYSEC-2025-121
An issue in keras 3.7.0 allows attackers to write arbitrary files to the user's machine via downloading a crafted tar file through the get_file function.
3.8.0
Affected by 15 other vulnerabilities.
VCID-prjz-56nu-wyez
Aliases:
GHSA-28jp-44vh-q42h
Duplicate Advisory: Keras keras.utils.get_file API is vulnerable to a path traversal attack
3.12.0
Affected by 4 other vulnerabilities.
VCID-qnnt-t7u7-bbfw
Aliases:
CVE-2024-3660
GHSA-x4wf-678h-2pmq
A arbitrary code injection vulnerability in TensorFlow's Keras framework (<2.13) allows attackers to execute arbitrary code with the same permissions as the application using a model that allow arbitrary code irrespective of the application.
2.13.1rc0
Affected by 8 other vulnerabilities.
VCID-rg36-jn72-cyab
Aliases:
CVE-2026-1462
GHSA-4f3f-g24h-fr8m
A vulnerability in the `TFSMLayer` class of the `keras` package, version 3.13.0, allows attacker-controlled TensorFlow SavedModels to be loaded during deserialization of `.keras` models, even when `safe_mode=True`. This bypasses the security guarantees of `safe_mode` and enables arbitrary attacker-controlled code execution during model inference under the victim's privileges. The issue arises due to the unconditional loading of external SavedModels, serialization of attacker-controlled file paths, and the lack of validation in the `from_config()` method.
3.13.2
Affected by 0 other vulnerabilities.
Vulnerabilities fixed by this package (0)
Vulnerability Summary Aliases
This package is not known to fix vulnerabilities.

Date Actor Action Vulnerability Source VulnerableCode Version
2026-06-13T10:04:04.846522+00:00 GHSA Importer Affected by VCID-1wpv-agrc-7ydb https://github.com/advisories/GHSA-36fq-jgmw-4r9c 38.6.0
2026-06-13T09:50:15.481580+00:00 GHSA Importer Affected by VCID-n61b-6n8p-dbgk https://github.com/advisories/GHSA-cjgq-5qmw-rcj6 38.6.0
2026-06-12T22:01:45.408534+00:00 GitLab Importer Affected by VCID-rg36-jn72-cyab https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/keras/CVE-2026-1462.yml 38.6.0
2026-06-12T20:38:01.207364+00:00 GitLab Importer Affected by VCID-2331-v9sq-4qb9 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/keras/CVE-2025-12060.yml 38.6.0
2026-06-12T20:37:07.062716+00:00 GitLab Importer Affected by VCID-fpk2-6qn4-auem https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/keras/CVE-2025-12638.yml 38.6.0
2026-06-12T20:28:15.879262+00:00 GitLab Importer Affected by VCID-prjz-56nu-wyez https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/keras/GHSA-28jp-44vh-q42h.yml 38.6.0
2026-06-12T20:27:36.622326+00:00 GitLab Importer Affected by VCID-4q7c-unxm-5qaz https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/keras/CVE-2025-12058.yml 38.6.0
2026-06-12T20:20:07.955310+00:00 GitLab Importer Affected by VCID-1wpv-agrc-7ydb https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/keras/CVE-2025-9906.yml 38.6.0
2026-06-12T19:54:37.663430+00:00 GitLab Importer Affected by VCID-hnzb-7u2f-3ba5 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/keras/GHSA-5478-v2w6-c6q7.yml 38.6.0
2026-06-12T19:49:21.116851+00:00 GitLab Importer Affected by VCID-n61b-6n8p-dbgk https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/keras/CVE-2024-55459.yml 38.6.0
2026-06-12T19:25:35.744425+00:00 GitLab Importer Affected by VCID-qnnt-t7u7-bbfw https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/keras/CVE-2024-3660.yml 38.6.0