CVE-2025-12638: Duplicate Advisory Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-9g7v-8wxv-mwxp
CVSS 8.0
CWE-22
Published
Advisory Summary

CVE-2025-12638 is a HIGH (CVSS 8.0) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Duplicate Advisory libraries in the PyPI ecosystem. The issue involves keras keras.utils.get_file api is vulnerable to a path traversal attack. Remediation is available by upgrading affected packages to version 3.12.0.

CVE-2025-12638 at a Glance

CVE Identifier CVE-2025-12638
GHSA Identifier GHSA-9g7v-8wxv-mwxp
Severity HIGH
CVSS v3.1 Base Score 8.0
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Duplicate Advisory
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.0

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2025-12638

To remediate this vulnerability, upgrade all affected Duplicate Advisory 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.0
pip install Keras>=3.12.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-2025-12638, inspect your installed packages using pip:

pip show Keras

Analyze the terminal output to locate any version of Duplicate Advisory in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.12.0), 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 Duplicate Advisory, 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

### Duplicate Advisory This advisory has been withdrawn because it is a duplicate of GHSA-hjqc-jx6g-rwp9. This link is maintained to preserve external references. ### Original Description Keras version 3.11.3 is affected by a path traversal vulnerability in the keras.utils.get_file() function when extracting tar archives. The vulnerability arises because the function uses Python's tarfile.extractall() method without the security-critical filter='data' parameter. Although Keras attempts to filter unsafe paths using filter_safe_paths(), this filtering occurs before extraction, and a PATH_MAX symlink resolution bug triggers during extraction. This bug causes symlink resolution to fail due to path length limits, resulting in a security bypass that allows files to be written outside the intended extraction directory. This can lead to arbitrary file writes outside the cache directory, enabling potential system compromise or malicious code execution. The vulnerability affects Keras installations that process tar archives with get_file() and does not affect versions where this extraction method is secured with the appropriate filter parameter.

CVE-2025-12638 Affected Duplicate Advisory Versions

1 component(s)
Fixed Versions:
3.12.0
Product / Package Ecosystem Affected Versions Fixed Version
Keras
PyPI
< 3.12.0
3.12.0

References

Frequently Asked Questions

What is CVE-2025-12638?
CVE-2025-12638 is a security vulnerability in Duplicate Advisory involving Keras keras.utils.get_file API is vulnerable to a path traversal attack under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Duplicate Advisory versions are affected?
Affected versions include releases prior to 3.12.0 across affected packages: Keras.
What version fixes CVE-2025-12638?
Upgrading to 3.12.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.0. Upgrade your dependency to 3.12.0 or later.
What is the CVSS score of CVE-2025-12638?
CVE-2025-12638 has a CVSS v3.1 base score of 8.0 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2025-12638?
CVE-2025-12638 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-2025-12638?
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-9g7v-8wxv-mwxp",
  "modified" : "2025-12-02T00:09:26Z",
  "published" : "2025-11-28T15:30:30Z",
  "withdrawn" : "2025-12-02T00:09:26Z",
  "aliases" : [ "CVE-2025-12638" ],
  "summary" : "Duplicate Advisory: Keras keras.utils.get_file API is vulnerable to a path traversal attack",
  "details" : "### Duplicate Advisory\nThis advisory has been withdrawn because it is a duplicate of GHSA-hjqc-jx6g-rwp9. This link is maintained to preserve external references.\n\n### Original Description\nKeras version 3.11.3 is affected by a path traversal vulnerability in the keras.utils.get_file() function when extracting tar archives. The vulnerability arises because the function uses Python's tarfile.extractall() method without the security-critical filter='data' parameter. Although Keras attempts to filter unsafe paths using filter_safe_paths(), this filtering occurs before extraction, and a PATH_MAX symlink resolution bug triggers during extraction. This bug causes symlink resolution to fail due to path length limits, resulting in a security bypass that allows files to be written outside the intended extraction directory. This can lead to arbitrary file writes outside the cache directory, enabling potential system compromise or malicious code execution. The vulnerability affects Keras installations that process tar archives with get_file() and does not affect versions where this extraction method is secured with the appropriate filter parameter.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Keras"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.12.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-12638"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/keras-team/keras/commit/47fcb397ee4caffd5a75efd1fa3067559594e951"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/keras-team/keras"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.com/bounties/f94f5beb-54d8-4e6a-8bac-86d9aee103f4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-12-02T00:09:26Z",
    "nvd_published_at" : "2025-11-28T15:16:00Z"
  }
}