/

CVE-2026-11816

Severity:

HIGH RISK

(8.1)

Path Traversal (CWE-22) in Keras Archive Extraction

CVE-2026-11816

Modified

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write Outside Target Directory

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Keras versions prior to 3.14.0 contain a path traversal flaw in their tar and zip extraction helpers that validate member paths against the process working directory instead of the intended extraction target.

In environments where the working directory is set to /, attackers who can supply crafted archives may write files outside the extraction directory, potentially overwriting configurations, injecting code, or corrupting ML assets.

Affected context

This vulnerability appears in Keras deployments that rely on keras.src.utils.file_utils for extracting tar or zip archives.

It is most risky when:

  • The process current working directory is / (common in Docker images, CI/CD jobs, and Jupyter notebooks)
  • Archives are obtained from external or semi-trusted sources (model artifacts, datasets, or pre-packaged pipelines)
  • Extraction paths are assumed to be confined to an application-controlled directory

Python 3.11 environments that lack the filter="data" safeguard are fully dependent on the flawed path validation logic.

Exploit preconditions

  • Attack surface: Archive ingestion endpoints or workflows that accept user-supplied or remotely hosted tar/zip files (e.g., datasets, pre-trained models, pipeline bundles).
  • Required access: Ability to influence or control the contents of tar/zip archives processed by Keras utilities.
  • Trigger point: Invocation of filter_safe_tarinfos() or filter_safe_zipinfos() during extraction to a target directory.
  • Why exploitation is possible: Path checks compare archive member paths against the current working directory rather than the actual extraction root. When the CWD is /, traversal sequences such as ../ are effectively evaluated against the filesystem root, allowing crafted entries to resolve outside the intended directory. Additionally, the zip filter bug can cause an AttributeError that interrupts extraction in an inconsistent state.

Why this happens

The underlying issue is a logic error in how Keras validates archive member paths before extraction, corresponding to CWE-22: Improper Limitation of a Pathname to a Restricted Directory.

Instead of normalizing and enforcing that each member's resolved path stays within the configured extraction directory, the code compares paths against the process current working directory, which may not match the extraction root and can be / in many containerized or notebook environments.

This design assumes the CWD defines a safe boundary, which is not guaranteed and breaks the expected sandboxing behavior.

In Python 3.11 installations, absence of the filter="data" security parameter in the standard library means the application fully trusts this flawed validation logic.

Potential impact

  • Attackers may write arbitrary files outside the intended extraction directory.
  • Configuration files, environment files, or secrets stored on the filesystem could be overwritten.
  • Malicious Python or shell scripts could be dropped into locations that are later executed by the application or other system components.
  • Machine learning datasets and model artifacts may be silently corrupted, affecting training outcomes and model integrity.
  • CI/CD pipelines and experiment tracking directories could be tampered with, undermining reproducibility and auditability.

General mitigation guidance

Effective mitigation focuses on tightening path handling and reducing trust in external archives:

  • Ensure archive extraction routines resolve and normalize member paths against the actual intended extraction base directory, rejecting any entry whose final path escapes that directory.
  • Treat all external tar/zip inputs as untrusted; restrict or gate their use through trusted channels and integrity checks (e.g., signatures, checksums).
  • Run archive extraction under identities and sandboxes with minimal filesystem privileges, limiting the blast radius of any unexpected writes.
  • Avoid setting the process current working directory to / in container, CI/CD, or notebook environments when using file extraction utilities.
  • Where feasible, introduce additional validation steps that enforce explicit allowlists of expected paths or directories within archives.

How teams detect issues like this

Organizations can approach detection of this class of issue through multiple layers:

  • Static analysis: Search for custom archive extraction code that:
  • Normalizes member paths relative to the current working directory instead of a dedicated extraction root.
  • Fails to check that os.path.realpath() or equivalent remains under the target directory.
  • Code review: Flag patterns where tar/zip members are extracted without explicit bounding of their destination paths, especially in data ingestion, model loading, and pipeline utilities.
  • Runtime monitoring: Log and alert on extraction processes writing into unexpected directories (e.g., /etc, /usr, or application configuration trees) when processing external archives.
  • Policy enforcement: Incorporate secure archive extraction guidelines into code review checklists and CI policies, and optionally employ automated tools that detect unsafe path handling around file operations.

Sources

SourceLink
github.comgithub.com/keras-team/keras/commit/2465b6657b02c8eed308759b7e800e295ae01888
huntr.comhuntr.com/bounties/a07e3983-7158-4419-af2b-38f1dea01a4f
access.redhat.comaccess.redhat.com/errata/RHSA-2026:42644
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-11816
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2487912
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-11816.json

Frequently asked

questions

Exploitability depends on whether an attacker can supply or influence archives extracted by Keras utilities. In environments that automatically fetch datasets or models from remote sources, the attack surface can be significant.

Not necessarily. Any mechanism that processes externally sourced tar/zip archives—such as user uploads, remote dataset downloads, or automated pipeline inputs—can serve as an entry point, even without direct interactive access.

The safest pattern is to enforce strict, normalized path checks against the intended extraction directory, rejecting any archive member whose resolved path escapes that directory. Complement this with least-privilege execution and avoidance of using / as the working directory for extraction tasks.

Treat all filesystem paths derived from external inputs as untrusted, always normalize and bound them to a known root, and adopt secure-by-default archive extraction helpers. Incorporate secure path handling guidelines into coding standards and use automated checks in CI to detect unsafe traversal patterns early.

Find out what's already
exploitable in your codebase.