CVE-2026-12479: Keras Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-gh82-f9x8-5frx
CVSS 6.1
CWE-22
Published
Advisory Summary

CVE-2026-12479 is a MODERATE (CVSS 6.1) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Keras libraries in the PyPI ecosystem. The issue involves diskiostore permits path traversal through crafted layer names. Remediation is available by upgrading affected packages to version 3.12.3, 3.15.0.

CVE-2026-12479 at a Glance

CVE Identifier CVE-2026-12479
GHSA Identifier GHSA-gh82-f9x8-5frx
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Keras
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2026-12479

To remediate this vulnerability, upgrade all affected Keras dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

keras fixed: 3.12.3
pip install keras>=3.12.3
keras fixed: 3.15.0
pip install keras>=3.15.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show keras

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-12479, inspect your installed packages using pip:

pip show keras

Analyze the terminal output to locate any version of Keras in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.12.3), your application is affected.

Note: The pip show keras command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Keras, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A path traversal vulnerability exists in keras-team/keras version 3.14.0, specifically in the `DiskIOStore.make` method within the Keras 3 model saving and loading library. This vulnerability arises from the improper handling of user-provided layer names, which are used to construct directory paths without sanitizing for parent directory components (`..`). While forward slashes (`/`) are restricted in layer names, directory traversal sequences are not. This allows an attacker to craft a malicious Keras model that, when saved or loaded, can escape the intended temporary working directory and perform unauthorized file system operations, such as creating directories or writing files in arbitrary locations.

CVE-2026-12479 Affected Keras Versions

2 component(s)
Fixed Versions:
3.12.33.15.0
Product / Package Ecosystem Affected Versions Fixed Version
keras
PyPI
< 3.12.3
3.12.3
keras
PyPI
≥ 3.13.0
< 3.15.0
3.15.0

References

Frequently Asked Questions

What is CVE-2026-12479?
CVE-2026-12479 is a security vulnerability in Keras involving DiskIOStore permits path traversal through crafted layer names under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Keras versions are affected?
Affected versions include releases prior to 3.12.3, 3.15.0 across affected packages: keras.
What version fixes CVE-2026-12479?
Upgrading to 3.12.3, 3.15.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is keras affected?
Yes, keras is affected in releases prior to 3.12.3, 3.15.0. Upgrade your dependency to 3.12.3, 3.15.0 or later.
What is the CVSS score of CVE-2026-12479?
CVE-2026-12479 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L.
What CWE is associated with CVE-2026-12479?
CVE-2026-12479 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check PyPI dependencies for CVE-2026-12479?
Run the dependency tree command: 'pip show keras'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gh82-f9x8-5frx",
  "modified" : "2026-08-07T20:13:28Z",
  "published" : "2026-06-22T18:34:13Z",
  "aliases" : [ "CVE-2026-12479" ],
  "summary" : "Keras: DiskIOStore permits path traversal through crafted layer names",
  "details" : "A path traversal vulnerability exists in keras-team/keras version 3.14.0, specifically in the `DiskIOStore.make` method within the Keras 3 model saving and loading library. This vulnerability arises from the improper handling of user-provided layer names, which are used to construct directory paths without sanitizing for parent directory components (`..`). While forward slashes (`/`) are restricted in layer names, directory traversal sequences are not. This allows an attacker to craft a malicious Keras model that, when saved or loaded, can escape the intended temporary working directory and perform unauthorized file system operations, such as creating directories or writing files in arbitrary locations.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "keras"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.12.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "keras"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.13.0"
      }, {
        "fixed" : "3.15.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-12479"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keras-team/keras/pull/23017"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keras-team/keras/commit/d8caeb58cc9e61ea092445dc7a20908ca8d693e2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/keras-team/keras"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keras-team/keras/releases/tag/v3.12.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keras-team/keras/releases/tag/v3.15.0"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.com/bounties/188836b9-12fc-49c7-8dbf-04f60fe33743"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-07T20:13:28Z",
    "nvd_published_at" : "2026-06-22T16:16:33Z"
  }
}