CVE-2026-4360
Python Interpreter vulnerability analysis and mitigation

Overview

CVE-2026-4360 is an improper preservation of permissions vulnerability (CWE-281) in Python's tarfile standard library module. When Tarfile.extract() encounters a hardlink whose target is not yet present in the extraction directory, it falls back to extracting the file directly from the archive — but fails to pass the filter_function parameter to the internal _extract_one() method. As a result, files can be written with unexpected uid/gid ownership even when the caller explicitly passes filter='data'. The vulnerability affects CPython versions prior to 3.15.0 (with backports required for 3.10–3.14). It carries a CVSS v3.1 score of 5.3 (Medium) and a CVSS v4.0 score of 2.0 (Low) (Github Advisory, CPython Issue).

Technical details

The root cause is classified as CWE-281 (Improper Preservation of Permissions). In Lib/tarfile.py, the extract() method calls _get_extract_tarinfo() to resolve the member and apply the filter, then calls _extract_one() — but omits forwarding the filter_function argument to _extract_one(). When a hardlink's target is absent and the library falls back to extracting the file content directly, the filter is not re-applied during that secondary extraction, allowing the archive's embedded uid/gid metadata to be honored instead of being sanitized. The fix is a one-line change: passing filter_function=filter_function to _extract_one() (CPython PR #151988, Commit 5e0ef3f). Exploitation requires an attacker to supply a crafted tar archive containing a hardlink entry with a malicious uid/gid to an application that processes untrusted archives using Tarfile.extract() with a security filter.

Impact

Successful exploitation results in files being written to disk with attacker-controlled uid/gid ownership, bypassing the security intent of the filter='data' parameter. The impact is limited to integrity — there is no confidentiality or availability impact. In practice, this could allow an attacker to cause extracted files to be owned by a privileged user or group, potentially enabling privilege escalation or unauthorized access if those files are subsequently executed or read by a higher-privileged process (Github Advisory).

Exploitation steps

  1. Craft a malicious tar archive: Create a tar file containing a regular file entry (e.g., target) with a desired uid/gid (e.g., uid=0, gid=0), followed by a hardlink entry (e.g., link) pointing to target with the same or different uid/gid metadata.
  2. Ensure hardlink target is absent: Structure the archive so that when extract('link', ...) is called individually, the hardlink target (target) has not yet been extracted to the destination directory, triggering the fallback extraction path.
  3. Deliver the archive to the target application: Supply the crafted tar file to an application that calls tarfile.TarFile.extract() with filter='data' on untrusted input (e.g., via file upload, network delivery, or package installation pipeline).
  4. Trigger extraction: The application calls tar.extract('link', path=dest, filter='data'). Due to the bug, _extract_one() is called without the filter, and the file is written with the attacker-specified uid/gid.
  5. Leverage the ownership change: If the extracted file is subsequently executed or accessed by a privileged process, the unexpected ownership may enable privilege escalation or unauthorized access (CPython Issue, CPython PR #151988).

Indicators of compromise

  • File System: Extracted files with unexpected uid/gid ownership (e.g., uid=0/root) in directories where unprivileged users or applications perform tar extraction; hardlink entries in extracted archives with mismatched ownership metadata.
  • Logs: Application logs showing tarfile.extract() calls on externally supplied archives; OS-level audit logs (auditd) recording chown() or lchown() syscalls on newly extracted files with elevated uid/gid values.
  • Process: Python processes invoking tarfile.extract() or tarfile.extractall() on user-supplied or network-sourced .tar files, particularly in package managers, CI/CD pipelines, or file processing services.

Mitigation and workarounds

The Python Software Foundation has released patches backported to CPython 3.10, 3.11, 3.12, 3.13, 3.14, and 3.15. Users should upgrade to a patched release as soon as available for their branch. As a workaround, avoid extracting tar archives from untrusted sources, or manually validate file ownership and permissions after extraction. Applications can also implement a custom filter function that explicitly resets uid/gid to safe values for all extracted members (CPython PR #151988, Python Security Announce).

Community reactions

The Python Security team treated this as a security issue following precedent set by a related tarfile advisory (GHSA-379m-ccvw-g66r), though the severity was assessed as low. The fix was developed by CPython core developer Petr Viktorin (encukou) and reviewed by StanFromIreland, with backports coordinated across all active Python maintenance branches. No significant broader media coverage or social media discussion has been observed given the low severity rating (CPython PR #151988).

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