CPython tarfile link-fallback ignores extraction filter rejection (filter bypass)
AI analysis
CVE-2026-87910 is a filter-bypass flaw in CPython's tarfile module: when tarfile extracts a hard or symbolic link on a filesystem that does not support links, it falls back to extracting the member the link points to, and the extraction filter is run twice, once for the extracted member and once with the name set to the link's location. In one of these two calls, a None return value, which is how a custom filter rejects or skips a member, was ignored, so a member the filter rejected could still be written to disk. An attacker who can supply a crafted tar archive could thereby extract members to locations the filter was intended to prevent, producing unintended or potentially traversing file placement (CWE-22, CWE-59; the CVSS 4.0 score of 5.7 reflects high integrity impact with no confidentiality or availability impact). Affected users are those running CPython and extracting archives with a custom extraction filter that rejects members via None on a filesystem without link support; the advisory data does not specify the affected version ranges. No public proof-of-concept, CISA KEV listing, or known exploitation has been reported.
What to do: Upgrade CPython to a release containing the fix for CVE-2026-87910 as soon as your vendor or distribution ships it, monitoring python.org security advisories for the patched versions. As an interim mitigation, do not rely on a custom extraction filter's None return to skip members when extracting archives containing hard or symbolic links on filesystems without link support, and audit code paths that call extract/extractall with user-controlled archives. After patching, review extraction destinations for members that should have been skipped.
Affected
| Python Software Foundation CPython (tarfile module) | — |
Estimated exposure
nicheLikely on the order of hundreds to a few thousand Python environments; no public telemetry quantifies custom extraction-filter usage on link-less filesystems — The trigger requires a rare combination, a custom tarfile extraction filter that rejects members by returning None plus extraction of a link on a filesystem lacking link support, so only a small slice of Python's very large install base is…
Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.
Description
When tarfile extracts a link on a system that doesn't support links, it falls back to extracting a member from the archive. In this case, the filter function is run twice: once for the extracted member, and once with name set to the location of the link. For one of the calls, the return value was ignored. Instead, the member should be skipped if either call returns None.