CVE-2025-4138 affects Python's standard-library tarfile module. When extracting untrusted tar archives with TarFile.extractall() or TarFile.extract() using the filter= parameter set to "data" or "tar", the extraction filter can be bypassed. This allows symlink targets in the archive to resolve outside the intended destination directory and also permits modification of some file metadata despite the expected filtering behavior. The issue is specifically relevant to workflows that rely on tarfile extraction filters as a security boundary when handling untrusted archives. The provided content also notes that in Python 3.14 and later the default filter changed from no filtering to "data", which expands exposure for applications relying on that default behavior.
Mallory correlates every CVE against your assets, your vendors, and active adversary campaigns. Know which vulnerabilities matter for you, not just which ones are loud.
What it means. What to do now. Patch path, mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
If you can’t patch tonight, do this now.
Patch, then assume compromise.
6 valid exploits after Mallory filtered fakes, detection scripts, and README-only repos.
This repository is a small standalone Python proof-of-concept exploit for CVE-2025-4138, containing only a README and one executable script, cve_2025_4138.py. It is not part of a larger exploit framework. The Python script is the main entry point and uses only standard library modules such as argparse, os, io, stat, struct, sys, and tarfile. The exploit's purpose is to generate a malicious tar archive that abuses Python tarfile extraction logic via a symlink-chain PATH_MAX bypass. The code constructs a deep directory/symlink chain using fixed-length directory names, then adds a pivot symlink whose resolution exceeds PATH_MAX, causing safety validation based on path canonicalization to fail or be skipped. It then creates an escape symlink that traverses back out of the extraction tree and points to an attacker-specified absolute filesystem path. Finally, it writes attacker-controlled payload bytes through that escape path into the archive, so extraction on a vulnerable target results in an arbitrary file write outside the intended extraction directory. Capabilities exposed by the script include: selecting the output tarball path, choosing an absolute target file path, supplying payload content from a local file, a literal string, or an SSH public key file, setting file permissions in octal, adjusting traversal depth, and optionally verifying archive contents after creation. The README demonstrates likely post-exploitation uses such as planting /root/.ssh/authorized_keys for access or writing a cron file for persistence. The exploit itself does not perform network exploitation or delivery; it is a file-based archive generator intended to be consumed by a separate vulnerable extraction workflow. Repository structure is minimal: README.md documents the vulnerability, usage, examples, and mitigations; cve_2025_4138.py implements argument parsing, payload loading, target-path validation, malicious tarball construction, and optional verification. Overall, this is a functional arbitrary-file-write PoC with a basic but usable payload model, making it operational rather than a mere detection script.
Repository contains a single Python PoC (exploit.py) and a README describing CVE-2025-4138, a tarfile extraction filter bypass involving PATH_MAX and symlink expansion differences between os.path.realpath() validation and later extraction. Structure & purpose: - README.md: Explains the vulnerability concept (realpath expansion exceeding PATH_MAX), links to a Google security advisory, and provides a privilege-escalation scenario by planting an SSH public key into /root/.ssh/authorized_keys. - exploit.py: Generates a malicious tar archive (file.tar). It builds a chain of directory entries and symlinks (using steps a..p and a repeated-character directory name sized differently for macOS vs others) to create a final symlink path that becomes longer than PATH_MAX only after symlink substitution. It then adds an "escape" symlink that resolves to /root, and finally adds a regular file entry at escape/.ssh/authorized_keys containing the attacker-supplied key read from a local file named authorized_keys. Exploit capabilities: - Produces a crafted tar payload that, when extracted by a vulnerable Python tarfile-based extractor running with elevated privileges, can write files outside the intended extraction directory. - Demonstrated payload effect is privilege escalation by writing to /root/.ssh/authorized_keys, enabling root SSH login with the attacker’s private key. Notable observations: - The script prints "Created backup_9001.tar" but actually creates "file.tar" (minor inconsistency). - No network exploitation is performed by the code itself; the attack is delivered via a malicious archive and relies on a privileged extraction context.
Repository contains a single Python exploit generator (exploit.py) and a README describing usage. The script does not attack a network service; it produces a malicious tar archive intended to be extracted by a privileged process running a vulnerable Python tarfile implementation (CVE-2025-4138 / CVE-2025-4517, described as PATH_MAX truncation leading to path traversal and filter bypass). Structure & purpose: - README.md: Explains the vulnerability context, affected Python versions (as claimed), and an attack workflow: generate tar, deliver to target, wait for privileged extraction, then gain root via sudo. - exploit.py: Implements the tar crafting logic. It builds (1) a deep directory + symlink chain to inflate resolved path length toward PATH_MAX, (2) a pivot symlink with a very long name to induce early stop/truncation behavior, (3) an 'escape' symlink that ultimately resolves to /etc by combining the pivot path with multiple '../', and (4) a final tar file entry written to 'escape/sudoers.d/<user>' containing a sudoers rule granting NOPASSWD:ALL. File permissions are set to 0440 to satisfy sudoers requirements. Main exploit capabilities: - Arbitrary file write on extraction (via crafted symlink/path traversal conditions) with a concrete privilege-escalation payload. - Automatic selection of target username (defaults to current user via getpass.getuser()) and configurable output path. No external network endpoints, C2, or remote callbacks are present; the only actionable targets are filesystem paths, primarily /etc/sudoers.d/.
Repository purpose: a Python tool (“PyPath-Escape”) that generates a malicious tar archive intended to exploit a PATH_MAX-related symlink filter bypass in Python’s `tarfile` extraction logic (claimed CVE-2025-4138 / CVE-2025-4517). Structure: - `exploit.py` (main code): builds a crafted tar containing a long directory/symlink chain designed to reach near PATH_MAX, then introduces a pivot symlink (`pwn_portal`) that points back up (`../` repeated) and a second symlink (`pwn_escape`) that redirects into an attacker-chosen absolute target directory. Finally, it adds a regular file entry under `pwn_escape/<basename>` whose contents are attacker-supplied bytes from `--payload`. - `README.md`: marketing/description, references GHSA-hgqp-3mmf-7h8f and CPython PR #135037, and claims targeting the above CVEs. - `LICENSE` and `not.md`: legal disclaimers. Exploit capabilities (as implemented): - Produces a .tar that attempts to cause an arbitrary file write outside the intended extraction directory when extracted by vulnerable code. - Includes presets for high-impact targets: - `ssh-key`: writes to `/root/.ssh/authorized_keys` (root persistence). - `cron`: writes to `/etc/cron.d/pwned` (scheduled execution). - `sudoers`: writes to `/etc/sudoers.d/pwned` (privilege escalation). Operational notes: - No network I/O is present; the attack vector is delivery of a malicious archive to a process that extracts it. - Success depends on the victim using a vulnerable `tarfile` extraction path and running extraction with sufficient filesystem privileges.
Repository contains a single Python exploit generator script and a README describing CVE-2025-4138 (Python tarfile filter="data" bypass). The script (CVE-2025-4138_tarfile_filter_bypass.py) builds a malicious tar archive that abuses PATH_MAX-limited os.path.realpath() resolution when validating symlinks under tarfile's data filter. It constructs: (1) a 16-level directory + symlink alias chain using long directory names (~247 chars each) to inflate the resolved path near Linux PATH_MAX; (2) a pivot symlink that appends many "../" components such that realpath() stops resolving once the path is too long, leaving traversal components as literals; (3) an "escape" symlink that routes through the pivot and then down into the attacker-specified absolute target directory; and (4) a regular file entry written via escape/<target_basename> containing attacker-supplied bytes read from a local payload file. When a vulnerable Python version extracts this tar with filter="data", the filter is bypassed and the kernel follows the symlink traversal, resulting in an arbitrary file write outside the extraction directory. No network activity is present; the primary observable targets are filesystem paths (attacker-chosen absolute target) and tar internal entry names (escape, the symlink chain).
Repository contains a single Python exploit generator (exploit.py) plus README and LICENSE. The exploit targets CPython tarfile extraction filter bypass vulnerabilities CVE-2025-4138 and CVE-2025-4517 affecting Python 3.12.0–3.12.10 and 3.13.0–3.13.3 on Linux/macOS. Core capability: it builds a malicious tar archive that abuses a TOCTOU gap between tarfile’s safety checks (which rely on os.path.realpath()) and the kernel’s symlink resolution during extraction. By constructing a deep chain of directories and symlinks whose fully-resolved path exceeds PATH_MAX, os.path.realpath() stops resolving and appends remaining components literally (including traversal like "../"). This allows the archive to pass tarfile’s filter="data"/"tar" checks while still escaping the intended extraction directory at extraction time, resulting in an arbitrary file write to an attacker-chosen absolute path. Operational behavior (from visible code/README): - CLI-driven tool that outputs a tar file (--tar-out) containing crafted symlink/directory entries and a final file entry that is written through the escaped symlink. - Supports direct targeting via --target (absolute path required) and --payload (file content to embed), with optional --mode to set file permissions. - Mentions preset attack modes (PRESETS) and a generator for preset payloads (e.g., SSH authorized_keys injection, cron, sudoers), though the preset definitions are in the truncated portion. - Includes a local Python version check that warns if the generator is run on a patched interpreter; exploitation depends on the target extractor’s Python version. No network C2 or callback endpoints are present; the primary “endpoints” are filesystem targets (e.g., /root/.ssh/authorized_keys, /etc/cron.d/privesc). The exploit is not part of a larger framework (standalone script).
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
Vendor-confirmed product mapping. Mallory continuously reconciles this list against your asset inventory.
16 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.
Query your assets running an affected version, and investigate the blast radius.
Every observed campaign linking this CVE to a named adversary.
Malware families riding this exploit, with evidence and IOCs.
YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Cross-references every affected SKU, including bundled OEM variants.
Community discussion across Reddit, Mastodon, and other social sources.