CVE-2026-11940
Python Interpreter vulnerability analysis and mitigation

Overview

CVE-2026-11940 is a path traversal and symlink escape vulnerability in Python's tarfile module affecting CPython versions prior to 3.15.0. When using tarfile.extractall() with the 'data' or 'tar' filter, a crafted tar archive can bypass directory containment by exploiting the hardlink-extraction fallback mechanism. This vulnerability is an incomplete fix of CVE-2025-4330 and was disclosed on June 23, 2026. It carries a CVSS v4.0 base score of 7.8 (High) (Github Advisory, Feedly).

Technical details

The root cause is classified as CWE-22 (Path Traversal) and CWE-59 (Improper Link Resolution Before File Access). The flaw exists in the makelink_with_filter function within Lib/tarfile.py: when a hardlink references a symlink stored at a deeper path (e.g., a/b/s), the extraction fallback validates the symlink at its archived location but recreates it at the hardlink's shallower path (e.g., s). Because the filter checks containment at the deeper path, a relative symlink target (e.g., ../escape) that appears contained at a/b/s actually escapes the destination directory when placed at s. The fix adds an additional filter check at the hardlink's actual write location before proceeding with extraction (CPython PR #151559, CPython Commit).

Impact

Successful exploitation allows an unauthenticated attacker who can supply a crafted tar archive to create symlinks pointing outside the intended extraction directory, enabling arbitrary file reads or writes on the host system. This can lead to sensitive file disclosure (e.g., reading /etc/shadow or application secrets) or arbitrary file write, which may be chained to achieve code execution by overwriting scripts, configuration files, or other writable assets. The impact is primarily on subsequent/downstream systems rather than the vulnerable Python process itself, as reflected in the CVSS v4.0 subsequent system confidentiality and integrity scores of High (Github Advisory, Feedly).

Exploitation steps

  1. Craft a malicious tar archive: Create a tar archive containing two entries: a symlink at a deep path (e.g., a/b/s) pointing to a relative target that escapes the destination (e.g., ../../etc/cron.d/backdoor), and a hardlink at a shallower path (e.g., s) referencing the deep symlink (a/b/s).
  2. Deliver the archive: Supply the crafted archive to a target application that uses tarfile.extractall() with the 'data' or 'tar' filter on untrusted input — for example, via a file upload endpoint, package installation, or build artifact processing.
  3. Trigger extraction: The application calls tarfile.extractall(filter='data') on the archive. The filter validates the symlink at a/b/s and judges the relative target ../../etc/cron.d/backdoor as contained (relative to the deep path), passing validation.
  4. Symlink escape occurs: The hardlink fallback recreates the symlink at the shallower path s within the extraction directory. Because s is at a shallower depth, the relative target now resolves outside the extraction directory (e.g., to /etc/cron.d/backdoor).
  5. Achieve out-of-destination read/write: The attacker can now read sensitive files by following the escaped symlink, or write arbitrary content to the symlink target (e.g., dropping a cron job for code execution) (CPython PR #151559, CPython Commit).

Indicators of compromise

  • File System: Unexpected symlinks within or near the tar extraction directory pointing to paths outside the intended destination (e.g., ../../etc/, /tmp/, or other sensitive directories); newly created or modified files in sensitive system directories (e.g., /etc/cron.d/, /etc/passwd, web root) shortly after a tar extraction event.
  • Logs: Application logs showing tar extraction operations on externally supplied archives; Python tracebacks or LinkFallbackError / LinkOutsideDestinationError exceptions in application logs (these would appear in a patched system rejecting the attack, but their absence on an unpatched system may indicate silent exploitation).
  • Process: Unexpected processes spawned by the application service account following archive extraction (e.g., shells, network tools), which may indicate code execution achieved via overwritten scripts or cron jobs.

Mitigation and workarounds

The Python Software Foundation has released patches for all supported branches: the fix is included in CPython 3.10 (backport PR #152080), 3.11 (backport PR #152001), 3.12 (backport PR #152000), 3.13 (backport PR #151999), 3.14 (backport PR #151998), and 3.15 (backport PR #151997). Users should upgrade to a patched release as soon as available for their branch (CPython PR #151559, Github Advisory). As a workaround, avoid extracting untrusted tar archives using tarfile.extractall() with the 'data' or 'tar' filter; instead, validate and sanitize archive contents before extraction, or use sandboxed/containerized extraction environments. Downstream distributions (e.g., Amazon Linux 2023, Buildroot, Debian, SUSE) are also issuing security patches.

Community reactions

The vulnerability was announced via the Python security mailing list and the oss-security list shortly after disclosure on June 23, 2026 (oss-sec, Python Security Announce). Downstream projects including Buildroot and the Yocto Project promptly issued security patches referencing the CVE. Security scanning vendors Nessus (plugin 323882) and Qualys (detection IDs 363085–363093) have added detection coverage. Community reaction has been measured, with the vulnerability noted as a bypass of the prior CVE-2025-4330 fix, highlighting the difficulty of fully securing the tarfile hardlink/symlink interaction.

Additional resources


SourceThis report was generated using AI

Related Python Interpreter vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-15308HIGH8.7
  • Rocky Linux logoRocky Linux
  • tkinter
NoYesJul 09, 2026
CVE-2026-11972HIGH8.2
  • Python Interpreter logoPython Interpreter
  • python3.11
NoYesJun 23, 2026
CVE-2026-11940HIGH7.8
  • Python Interpreter logoPython Interpreter
  • python3-libs
NoYesJun 23, 2026
CVE-2026-0864MEDIUM4.1
  • Python Interpreter logoPython Interpreter
  • python3.13-idle
NoYesJun 23, 2026
CVE-2026-4360LOW2
  • Python Interpreter logoPython Interpreter
  • python3.10
NoYesJun 30, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management