{"cve":"CVE-2025-12058","nvd":{"published":"2025-10-29T09:15:35.500","modified":"2026-10-19T13:10:00.110","status":"Deferred","description":"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).\n\n\nThis 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.\n\n  *  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.\n\n\n  *  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.\n\n\nThe 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.","cvss_v4":{"vector":"CVSS:4.0/AV:A/AC:H/AT:P/PR:L/UI:P/VC:H/VI:L/VA:L/SC:H/SI:L/SA:L","score":5.9},"cvss_v3":null,"cwes":["CWE-502"],"references":["https://github.com/keras-team/keras/pull/21751","https://github.com/keras-team/keras/security/advisories/GHSA-qg93-c7p6-gg7f"],"products":[],"source":"nvd","synced_at":"2026-10-19T22:14:53.307938015+00:00"},"epss":{"cve":"CVE-2025-12058","score":0.00248,"percentile":0.15929,"date":"2026-10-25"},"kev":null,"osv":[{"id":"GHSA-mq84-hjqx-cwf2","url":"https://osv.dev/vulnerability/GHSA-mq84-hjqx-cwf2","summary":"Keras is vulnerable to arbitrary local file loading and Server-Side Request Forgery","modified":"2026-09-10T03:50:30.088210152Z","packages":[{"ecosystem":"PyPI","name":"keras","purl":"pkg:pypi/keras","ranges":["<3.12.0"],"fixed":["3.12.0"]}]},{"id":"PYSEC-2026-1487","url":"https://osv.dev/vulnerability/PYSEC-2026-1487","summary":"Keras is vulnerable to arbitrary local file loading and Server-Side Request Forgery","modified":"2026-07-07T17:57:32.006640385Z","packages":[{"ecosystem":"PyPI","name":"keras","purl":"pkg:pypi/keras","ranges":["<3.12.0"],"fixed":["3.12.0"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}