Skip to main content
Public proof of conceptFix available

CVE-2025-4138

Bypassing extraction filter to create symlinks to arbitrary targets outside extraction directory

A public proof of concept exists; no exploitation attested.

  • Published2025-06-03
  • Fixed in3.13.4 · 3.12.11 · 3.11.13 · 3.10.18 · 3.9.23
  • WeaknessCWE-22

Am I affected?

With a domain, we read the version its public headers and pages expose. A distribution build can carry the fix under an older number.

Description

Allows the extraction filter to be ignored, allowing symlink targets to point outside the destination directory, and the modification of some file metadata. You are affected by this vulnerability if using the tarfile module to extract untrusted tar archives using TarFile.extractall() or TarFile.extract() using the filter= parameter with a value of "data" or "tar". See the tarfile extraction filters documentation https://docs.python.org/3/library/tarfile.html#tarfile-extraction-filter  for more information. Note that for Python 3.14 or later the default value of filter= changed from "no filtering" to `"data", so if you are relying on this new default behavior then your usage is also affected. Note that none of these vulnerabilities significantly affect the installation of source distributions which are tar archives as source distributions already allow arbitrary code execution during the build process. However when evaluating source distributions it's important to avoid installing source distributions with suspicious links.

Timeline

dates in UTC
  1. 2025-06-0313:15CVE publishedNVD

Versions per branch

OSV
python
BranchAffectedFixed in
3.13≥ 3.13.0, < 3.13.43.13.4
3.12≥ 3.12.0, < 3.12.113.12.11
3.11≥ 3.11.0, < 3.11.133.11.13
3.10≥ 3.10.0, < 3.10.183.10.18
3.9< 3.9.233.9.23
libpython
BranchAffectedFixed in
3.13≥ 3.13.0, < 3.13.43.13.4
3.12≥ 3.12.0, < 3.12.113.12.11
3.11≥ 3.11.0, < 3.11.133.11.13
3.10≥ 3.10.0, < 3.10.183.10.18
3.9< 3.9.233.9.23
python-min
BranchAffectedFixed in
3.13≥ 3.13.0, < 3.13.43.13.4
3.12≥ 3.12.0, < 3.12.113.12.11
3.11≥ 3.11.0, < 3.11.133.11.13
3.10≥ 3.10.0, < 3.10.183.10.18
3.9< 3.9.233.9.23

as publishedRanges as NVD and OSV publish them; a distribution’s build can be fixed under an older number.

Products declared by the CNA1 product

As PSF, the CNA that assigned this CVE, declared them in the CVE record; versions as written.

  • Python Software Foundation CPythonother versions: not affected

    https://github.com/python/cpython

    Affected
    • < 3.9.23fixed in 3.9.23python
    • ≥ 3.10.0, < 3.10.18fixed in 3.10.18python
    • ≥ 3.11.0, < 3.11.13fixed in 3.11.13python
    • ≥ 3.12.0, < 3.12.11fixed in 3.12.11python
    • ≥ 3.13.0, < 3.13.4fixed in 3.13.4python
    • ≥ 3.14.0a1, < 3.14.0b3fixed in 3.14.0b3python

Source: the CNA record (CVE Program), © The MITRE Corporation,CVE Terms of UseCVE recordupdated 2026-07-31

Distribution builds and vendor advisories

Packages from OSV.dev and products from the vendors' CSAF advisories.

version not verifiedVersions not verified: read as OSV.dev and the vendors publish them, not checked against each vendor's release list.

Packages

  • cassandraCleanStartall versions · fixed in 5.0.6-r2and 1 other package
  • cassandra-fipsCleanStartall versions · fixed in 4.0.19-r3
  • cassandra-fipsCleanStartall versions · fixed in 4.1.10-r2
  • CythonRocky Linux:8all versions · fixed in 0:0.29.21-5.module+el8.10.0+1582+bc278001
  • CythonRocky Linux:8all versions · fixed in 0:0.29.21-5.module+el8.10.0+1860+afcc1c71
  • CythonRed Hat:enterprise_linux:8::crball versions · fixed in 0:0.29.21-5.module+el8.9.0+19644+d68f775dand 3 other packages
  • kserve-storage-controllerCleanStartall versions · fixed in 0.19.0-r0
  • mod_wsgiRocky Linux:8all versions · fixed in 0:4.7.1-7.module+el8.10.0+1582+bc278001

310 more package ranges on OSV.dev

Vendor advisories

  • CVE-2025-4138 Red Hat Product Security1,061 products fixed

    cpython: python: Bypassing extraction filter to create symlinks to arbitrary targets outside extraction directory

  • ICSA-26-043-06 CISA16 known affected

    Siemens SINEC OS

    RUGGEDCOM RST2428P (6GK6242-6PA00) · SCALANCE XC-300/XR-300/XC-400/XR-500WG/XR-500 family · SCALANCE XCH328 (6GK5328-4TS01-2EC2) · +13 more

  • SSA-089022 Siemens ProductCERT16 known affected

    SSA-089022: Multiple Vulnerabilities in Third-Party Components in SINEC OS before V3.3

    RUGGEDCOM RST2428P (6GK6242-6PA00) · SCALANCE XC-300/XR-300/XC-400/XR-500WG/XR-500 family · SCALANCE XCH328 (6GK5328-4TS01-2EC2) · +13 more

  • RHSA-2026:0934 Red Hat Product Security30 products fixed

    Red Hat Security Advisory: Release of OpenShift Serverless Logic 1.36.0 security update & enhancements

  • RHSA-2025:23530 Red Hat Product Security229 products fixed

    Red Hat Security Advisory: python39:3.9 security update

  • RHSA-2025:18219 Red Hat Product Security4 products fixed

    Red Hat Security Advisory: cert-manager Operator for Red Hat OpenShift 1.16.0

14 more advisories

Full record on NVD

Fix

  1. Update python to 3.13.4 · 3.12.11 · 3.11.13 · 3.10.18 · 3.9.23
  2. Vendor fix CISA ICSA-26-043-06 · 14 productsUpdate to V3.3 or later version
  3. Vendor fix CISA ICSA-26-043-06 · 1 productSee Section Additional Information.
  4. Vendor fix Siemens ProductCERT SSA-089022 · 14 productsUpdate to V3.3 or later version
  5. Vendor fix Siemens ProductCERT SSA-089022 · 1 productSee Section Additional Information.
  6. Vendor fix Red Hat Product Security RHSA-2026:0934 · 30 productsBefore applying this update, make sure all previously released errata relevant to your system have been applied. For details on how to apply this update, refer to: https://access.redhat.com/articles/11258
  7. Vendor fix Red Hat Product Security RHSA-2025:23530 · 229 productsFor details on how to apply this update, which includes the changes described in this advisory, refer to: https://access.redhat.com/articles/11258

Detection

read 2026-11-01 01:02 UTC
Nuclei template
none so far
ProjectDiscovery
Exploit-DB
no entry
Exploit-DB
Metasploit modules
none listed
Metasploit Framework

Sources

Identifiers

Technical details

CVSS v3 Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Published
2025-06-03
Last Modified
2026-07-31
NVD status
Deferred
GitHub Advisory
GHSA-4g4g-fqw4-prp2

Frequently asked questions

What is CVE-2025-4138?

Allows the extraction filter to be ignored, allowing symlink targets to point outside the destination directory, and the modification of some file metadata. You are affected by this vulnerability if using the tarfile module to extract untrusted tar archives using TarFile.extractall() or TarFile.extract() using the filter= parameter with a value of "data" or "tar". See the tarfile extraction filters documentation https://docs.python.org/3/library/tarfile.html#tarfile-extraction-filter  for more information. Note that for Python 3.14 or later the default value of filter= changed from "no filtering" to `"data", so if you are relying on this new default behavior then your usage is also affected. Note that none of these vulnerabilities significantly affect the installation of source distributions which are tar archives as source distributions already allow arbitrary code execution during the build process. However when evaluating source distributions it's important to avoid installing source distributions with suspicious links.

Is CVE-2025-4138 actively exploited?

Active exploitation of CVE-2025-4138 has not been confirmed. Its EPSS score was 1.5% on 2026-11-09, the estimated probability of exploitation in the next 30 days.

What is the CVSS score for CVE-2025-4138?

CVE-2025-4138 has a CVSS v3 base score of 7.5 (HIGH severity), with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.

Running Python? Hear about its next vulnerability

Surveillance reads the versions in your stack — a domain, a lockfile or a list — checks each CVE against the ranges its sources publish, and alerts you when one you run is exploited or enters CISA KEV. A version it cannot read stays « version not verified ».

No credit card required · No monthly cap on website lookups · 250 API requests/month

Sources for this record