{"id":"CVE-2025-12058","published":"2025-10-29T08:48:29Z","modified":"2025-10-29T14:11:03Z","title":"Vulnerability in Keras Model.load_model Leading to Arbitrary Local File Loading and SSRF","vendor":"Keras","product":"Keras","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.9,"severity":"MEDIUM","version":"4.0","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","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00613,"percentile":0.43572,"provenance":"source"},"cwes":[{"id":"CWE-502","name":"Deserialization of Untrusted Data"}],"references":[{"url":"https://github.com/keras-team/keras/security/advisories/GHSA-qg93-c7p6-gg7f","tags":[]},{"url":"https://github.com/keras-team/keras/pull/21751","tags":[]}],"priority":{"score":12.8,"factors":[{"name":"EPSS percentile","points":8.71},{"name":"CVSS severity","points":4.13}]},"vendorSlug":"keras","affectedVersions":[{"vendor":"Keras","product":"Keras","versions":["< 3.12.0"]}],"capec":[{"id":"CAPEC-221","name":"Data Serialization External Entities Blowup"}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2025-10-29T14:07:04.803189Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"keras","vulnerableRanges":["<3.12.0"],"patched":["3.12.0"],"from":["GHSA-mq84-hjqx-cwf2","PYSEC-2026-1487"],"provenance":"source"}],"summary":{"text":"The Keras Model.load_model method (Keras product) fails to restrict external file paths in the StringLookup layer's vocabulary argument, even when safe_mode=True is set, which stems from untrusted deserialization of a crafted .keras archive. An attacker who can supply a malicious .keras model file, with adjacent network access, low privileges, and a user who loads the model, can read arbitrary local files and make server-side requests to arbitrary network endpoints through tf.io.gfile.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:14:20Z"},"euvd":{"id":"EUVD-2025-36634","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2025-9906","published":"2025-09-19","fixed":"3.11.0","kev":false},{"cve":"CVE-2025-49655","published":"2025-10-17","fixed":"3.11.3","kev":false,"link":{"from":"CVE-2025-49655","to":"CVE-2025-12058","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:keras","fromFixed":"3.11.3","toFixed":"3.12.0","daysApart":12}]}},{"cve":"CVE-2025-9905","published":"2025-09-19","fixed":"3.11.3","kev":false},{"cve":"CVE-2025-12058","published":"2025-10-29","fixed":"3.12.0","kev":false},{"cve":"CVE-2025-12060","published":"2025-10-30","fixed":"3.12.0","kev":false},{"cve":"CVE-2026-0897","published":"2026-01-15","fixed":"3.13.2","kev":false},{"cve":"CVE-2026-1462","published":"2026-04-13","fixed":"3.13.2","kev":false}],"package":"PyPI:keras"}}