Path TraversalWeakness · CWE-22

CVE-2025-12638

HIGH · 8.0 CVSS v3.0 Published 2025-11-28
Mitigation only
No fix yet — a mitigation exists. There is no fixed release. A documented workaround reduces exposure in the meantime.
See remediation →
84/100
Remediation priority · High
Remotely reachable

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
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.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

Keras 3.11.3 contains a path traversal vulnerability in keras.utils.get_file() when extracting tar archives. The function uses tarfile.extractall() without the filter='data' parameter, and while a filter_safe_paths() function attempts to filter unsafe paths pre-extraction, a PATH_MAX symlink resolution bug during extraction causes this filtering to be bypassed, allowing arbitrary file writes outside the cache directory.

MitigationApply the filter='data' parameter to tarfile.extractall() in the get_file() function, or upgrade to a Keras version where this extraction method is properly secured.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
Low
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Identify installed Keras version
    Run 'python -c "import keras; print(keras.__version__)"' or 'pip show keras' to get the version number
    Affected if Version is 3.x and the tarfile extraction vulnerability is present (pre-fix)
  2. Locate the get_file function source
    Find keras/utils.py or keras/utils/data_utils.py in your installation and inspect the get_file() function implementation
    Affected if The code uses tarfile.extractall() without the filter='data' parameter and lacks proper symlink path validation
  3. Check for symlink filter implementation
    Search the keras source for filter_safe_paths() function and verify if it properly handles PATH_MAX symlink resolution during extraction
    Affected if The filter_safe_paths() function exists but contains a PATH_MAX symlink resolution bug that allows path traversal bypass
  4. Identify tar archive downloads in your code
    Search your codebase for calls to keras.utils.get_file() or keras.utils.data_utils.get_file() where the extracted file is a .tar, .tar.gz, .tgz, or .tar.bz2 archive
    Affected if Your code uses get_file() to download and extract tar archives, triggering the vulnerable extraction path

You are affected if you have Keras 3.x version and your code uses keras.utils.get_file() to download and extract tar archives, which triggers the unprotected tarfile.extractall() with the path traversal bypass.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Mitigation available No clean upgrade yet — mitigate in the meantime
Mitigation

Apply the filter='data' parameter to tarfile.extractall() in the get_file() function, or upgrade to a Keras version where this extraction method is properly secured.

Recommended fix Moderate confidence

Latest stable Keras version (after 3.11.3) with tarfile.extractall() using filter='data' parameter

  1. 1. Identify the current Keras version by running: pip show keras or import keras; print(keras.__version__)
  2. 2. Check if the installed version is 3.11.3 or affected by this vulnerability
  3. 3. Upgrade to the latest Keras version by running: pip install --upgrade keras
  4. 4. Verify the upgrade was successful by checking the new version
  5. 5. If using a locked dependency file (requirements.txt, setup.py, pyproject.toml), update the keras version constraint to the latest stable release
  6. 6. Test that keras.utils.get_file() functionality still works as expected after the upgrade
Caveat Minimal risk - this is a security hardening fix; verify any custom get_file() usage works correctly after upgrade

Generated from the published advisory — verify against the referenced sources before acting.

Have this fixed Scoped from the published advisory
  • Consultation2.0 h
  • Implementation2.0 h
  • Testing3.0 h
  • Review / QA2.0 h
9.0 hours of engineering $1,570
Get help mitigating

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $2,512.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2025-12638 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2025-12638 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data