REDHAT-BUG-2487912: Path Traversal
Keras versions prior to 3.14.0 are vulnerable to a path traversal issue in the archive extraction utilities located in keras/src/utils/fileutils.py. The functions filtersafetarinfos() and filtersafezipinfos() validate archive member paths against the process current working directory (CWD) instead of the actual extraction destination. When the process runs with CWD set to /, which is common in Docker containers, CI/CD runners, and Jupyter environments, the validation boundary becomes the filesystem root, allowing traversal paths to bypass the security check. Additionally, the zip filter contains a bug that causes an AttributeError when a blocked entry is encountered, leading to incomplete extraction. Furthermore, Python 3.11 installations lack the filter="data" safety net, leaving them entirely reliant on the flawed CWD-based filter. Exploitation of this vulnerability can result in arbitrary file writes outside the intended extraction directory, enabling attackers to overwrite configuration files, inject malicious code, or corrupt machine learning datasets and pipelines.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Kerasto a version that resolves this vulnerability.Fixed in 3.14.0 - Configuration
Update the archive extraction utilities so filter_safe_tarinfos() and filter_safe_zipinfos() validate archive member paths against the real extraction destination (not the process current working directory/CWD).
Keras archive extraction utilities (filter_safe_tarinfos / filter_safe_zipinfos in keras/src/utils/file_utils.py) Archive path validation boundary = Validate against the actual extraction destination instead of process CWD - Compensating control
Avoid running the process with CWD set to `/` (e.g., in Docker/CI/CD/Jupyter environments). Set the working directory to a non-root path so CWD-based validation cannot become the filesystem root boundary.
Event History
Frequently Asked Questions
What is the severity of REDHAT-BUG-2487912?
The severity of REDHAT-BUG-2487912 is classified as high with a score of 7.
How do I fix REDHAT-BUG-2487912?
You can fix REDHAT-BUG-2487912 by updating to Keras version 3.14.0 or later.
What vulnerability does REDHAT-BUG-2487912 describe?
REDHAT-BUG-2487912 describes a path traversal vulnerability in Keras versions prior to 3.14.0.
What functions are affected by REDHAT-BUG-2487912?
The functions affected by REDHAT-BUG-2487912 are filter_safe_tarinfos() and filter_safe_zipinfos() in the file_utils.py.
What potential impact does REDHAT-BUG-2487912 have?
REDHAT-BUG-2487912 could allow an attacker to exploit the path traversal issue to access unauthorized files on the system.