CVE-2025-12638
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 · uneditedKeras 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 confidenceKeras 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.
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 checksWork through these to decide whether this CVE applies to you.
-
Identify installed Keras versionRun 'python -c "import keras; print(keras.__version__)"' or 'pip show keras' to get the version numberAffected if Version is 3.x and the tarfile extraction vulnerability is present (pre-fix)
-
Locate the get_file function sourceFind keras/utils.py or keras/utils/data_utils.py in your installation and inspect the get_file() function implementationAffected if The code uses tarfile.extractall() without the filter='data' parameter and lacks proper symlink path validation
-
Check for symlink filter implementationSearch the keras source for filter_safe_paths() function and verify if it properly handles PATH_MAX symlink resolution during extractionAffected if The filter_safe_paths() function exists but contains a PATH_MAX symlink resolution bug that allows path traversal bypass
-
Identify tar archive downloads in your codeSearch 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 archiveAffected 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.
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 · scopedApply 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.
Latest stable Keras version (after 3.11.3) with tarfile.extractall() using filter='data' parameter
- 1. Identify the current Keras version by running: pip show keras or import keras; print(keras.__version__)
- 2. Check if the installed version is 3.11.3 or affected by this vulnerability
- 3. Upgrade to the latest Keras version by running: pip install --upgrade keras
- 4. Verify the upgrade was successful by checking the new version
- 5. If using a locked dependency file (requirements.txt, setup.py, pyproject.toml), update the keras version constraint to the latest stable release
- 6. Test that keras.utils.get_file() functionality still works as expected after the upgrade
Generated from the published advisory — verify against the referenced sources before acting.
- Consultation2.0 h
- Implementation2.0 h
- Testing3.0 h
- Review / QA2.0 h
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 locallyCheck 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 sourcesPractitioner notes
ContributedPeer-ranked notes from engineers who’ve handled CVE-2025-12638 in production — separate from our analysis above.
The advisory tells you what broke. It rarely tells you what actually worked. If you’ve dealt with this one, that detail is what the next engineer is searching for.
- The version that genuinely resolved it — not the one the vendor claimed
- A config change or rule that shut the vector down
- A gotcha in the upgrade path that cost you an afternoon
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.
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.
- 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