{"id":72578,"date":"2025-10-29T12:18:29","date_gmt":"2025-10-29T08:48:29","guid":{"rendered":"https:\/\/afaghhosting.net\/blog\/cve-2025-12058-vulnerability-in-keras-model-load_model-leading-to-arbitrary-local-file-loading-and-ssrf\/"},"modified":"2025-10-29T12:18:29","modified_gmt":"2025-10-29T08:48:29","slug":"cve-2025-12058-vulnerability-in-keras-model-load_model-leading-to-arbitrary-local-file-loading-and-ssrf","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/cve-2025-12058-vulnerability-in-keras-model-load_model-leading-to-arbitrary-local-file-loading-and-ssrf\/","title":{"rendered":"CVE-2025-12058 &#8211; Vulnerability in Keras Model.load_model Leading to Arbitrary Local File Loading and SSRF"},"content":{"rendered":"<p>CVE ID : CVE-2025-12058<\/p>\n<p>Published :  Oct. 29, 2025, 8:48 a.m. | 34\u00a0minutes ago<\/p>\n<p>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).<\/p>\n<p>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.<\/p>\n<p>  *  Arbitrary Local File Read: An attacker can create a malicious .keras file that embeds a local path in the StringLookup layer&#8217;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.<\/p>\n<p>  *  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&#8217;s behalf, resulting in an SSRF condition.<\/p>\n<p>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.<\/p>\n<p>Severity: 5.9 | MEDIUM<\/p>\n<p>Visit the link for more details, such as CVSS details, affected products, timeline, and more&#8230;\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CVE ID : CVE-2025-12058 Published : Oct. 29, 2025, 8:48 a.m. | 34\u00a0minutes ago 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). This vulnerability stems from the way the StringLookup layer is handled during model loading from &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-72578","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/72578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=72578"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/72578\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=72578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=72578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=72578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}