
Cloud Vulnerability DB
A community-led vulnerabilities database
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).
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.
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).
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.extract('link', ...) is called individually, the hardlink target (target) has not yet been extracted to the destination directory, triggering the fallback extraction path.tarfile.TarFile.extract() with filter='data' on untrusted input (e.g., via file upload, network delivery, or package installation pipeline).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.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.tarfile.extract() or tarfile.extractall() on user-supplied or network-sourced .tar files, particularly in package managers, CI/CD pipelines, or file processing services.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).
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).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."