INCIDENT MAP

Browse / Unsafe Model Loading and Supply Chain / CVE-2025-12058

Keras is vulnerable to arbitrary local file loading and Server-Side Request Forgery

CVE-2025-12058 ยท 2025-10-29 moderate

Class
Unsafe Model Loading and Supply Chain (filed by a model that read the advisory)
Technique
Path traversal and file access
Also involves
AI Framework and Platform Flaws
Affected
keras (PyPI)
Gets past
Safe model loader or scanner
CVSS
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
EPSS
0.2% chance of exploitation in 30 days

How it works, in short

A crafted .keras archive sets a StringLookup vocabulary path to a local file or remote URL, and load_model reads it even with safe_mode enabled. (Our summary, written by a model. The source text is below.)

Details

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.

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.

References

Source: GitHub Advisory Database, used under CC BY 4.0.