CVE-2025-12058
Full vulnerability record from the local CVENow database.
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 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.
View original CVE JSON
{
"id": "CVE-2025-12058",
"sourceIdentifier": "[email protected]",
"published": "2025-10-29T09:15:35.500",
"lastModified": "2026-10-19T13:10:00.110",
"vulnStatus": "Deferred",
"cveTags": [],
"descriptions": [
{
"lang": "en",
"value": "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."
},
{
"lang": "es",
"value": "El método Keras.Model.load_model, incluso cuando se ejecuta con la mitigación de seguridad prevista safe_mode=True, es vulnerable a la carga arbitraria de archivos locales y a la falsificación de petición del lado del servidor (SSRF).\n\nEsta vulnerabilidad se deriva de la forma en que se maneja la capa StringLookup durante la carga del modelo desde un archivo .keras especialmente diseñado. El constructor de la capa StringLookup acepta un argumento vocabulary que puede especificar una ruta de archivo local o una ruta de archivo remota.\n\n* Lectura Arbitraria de Archivos Locales: Un atacante puede crear un archivo .keras malicioso que incrusta una ruta local en la configuración de la capa StringLookup. Cuando se carga el modelo, Keras intentará leer el contenido del archivo local especificado e incorporarlo al estado del modelo (por ejemplo, recuperable a través de get_vocabulary()), permitiendo a un atacante leer archivos locales arbitrarios en el sistema anfitrión.\n\n* Falsificación de Petición del Lado del Servidor (SSRF): Keras utiliza tf.io.gfile para operaciones de archivos. Dado que tf.io.gfile soporta manejadores de sistemas de archivos remotos (como GCS y HDFS) y protocolos HTTP/HTTPS, el mismo mecanismo puede ser aprovechado para obtener contenido de puntos finales de red arbitrarios en nombre del servidor, lo que resulta en una condición de SSRF.\n\nEl problema de seguridad es que la característica que permite la carga de rutas externas no fue restringida adecuadamente por el indicador safe_mode=True, el cual estaba destinado a prevenir dicho acceso no intencionado a los datos."
}
],
"affected": [
{
"source": "[email protected]",
"affectedData": [
{
"vendor": "Keras",
"product": "Keras",
"defaultStatus": "unaffected",
"versions": [
{
"version": "0",
"lessThan": "3.12.0",
"versionType": "date",
"status": "affected"
}
]
}
]
}
],
"metrics": {
"cvssMetricV40": [
{
"source": "[email protected]",
"type": "Secondary",
"cvssData": {
"version": "4.0",
"vectorString": "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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"baseScore": 5.9,
"baseSeverity": "MEDIUM",
"attackVector": "ADJACENT",
"attackComplexity": "HIGH",
"attackRequirements": "PRESENT",
"privilegesRequired": "LOW",
"userInteraction": "PASSIVE",
"vulnConfidentialityImpact": "HIGH",
"vulnIntegrityImpact": "LOW",
"vulnAvailabilityImpact": "LOW",
"subConfidentialityImpact": "HIGH",
"subIntegrityImpact": "LOW",
"subAvailabilityImpact": "LOW",
"exploitMaturity": "NOT_DEFINED",
"confidentialityRequirement": "NOT_DEFINED",
"integrityRequirement": "NOT_DEFINED",
"availabilityRequirement": "NOT_DEFINED",
"modifiedAttackVector": "NOT_DEFINED",
"modifiedAttackComplexity": "NOT_DEFINED",
"modifiedAttackRequirements": "NOT_DEFINED",
"modifiedPrivilegesRequired": "NOT_DEFINED",
"modifiedUserInteraction": "NOT_DEFINED",
"modifiedVulnConfidentialityImpact": "NOT_DEFINED",
"modifiedVulnIntegrityImpact": "NOT_DEFINED",
"modifiedVulnAvailabilityImpact": "NOT_DEFINED",
"modifiedSubConfidentialityImpact": "NOT_DEFINED",
"modifiedSubIntegrityImpact": "NOT_DEFINED",
"modifiedSubAvailabilityImpact": "NOT_DEFINED",
"Safety": "NOT_DEFINED",
"Automatable": "NOT_DEFINED",
"Recovery": "NOT_DEFINED",
"valueDensity": "NOT_DEFINED",
"vulnerabilityResponseEffort": "NOT_DEFINED",
"providerUrgency": "NOT_DEFINED"
}
}
],
"ssvcV203": [
{
"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"ssvcData": {
"timestamp": "2025-10-29T14:07:04.803189Z",
"id": "CVE-2025-12058",
"options": [
{
"exploitation": "none"
},
{
"automatable": "no"
},
{
"technicalImpact": "partial"
}
],
"role": "CISA Coordinator",
"version": "2.0.3"
}
}
]
},
"weaknesses": [
{
"source": "[email protected]",
"type": "Secondary",
"description": [
{
"lang": "en",
"value": "CWE-502"
}
]
}
],
"references": [
{
"url": "https://github.com/keras-team/keras/pull/21751",
"source": "[email protected]"
},
{
"url": "https://github.com/keras-team/keras/security/advisories/GHSA-qg93-c7p6-gg7f",
"source": "[email protected]"
}
]
}