Safeguard
Vulnerability Analysis•

CPython tarfile filter bypass CVE-2026-11940 and untrusted archives

A bypass of Python's tarfile extraction filter, CVE-2026-11940, lets a crafted archive write outside the destination. It matters only where you extract archives you did not build.

Safeguard Security Team
3 min read

On 24 August 2026 AlmaLinux published ALSA-2026:58901, a security update for Python 3.14 that fixes CVE-2026-11940: a bypass of CPython's tarfile extraction filter that lets a crafted archive write files outside the intended destination directory. The OSV record lists all earlier versions as affected, and the fixed build in that advisory is 3.14.7-2.el9_8.

I could only confirm this through distribution advisories. The upstream CPython changelog entry that I found for the underlying fix carries no CVE number, so check your distribution's package notes and the CPython changelog for your branch.

What's affected

Python 3.14 builds before the fixed package, per the AlmaLinux 9 advisory (python3.14, its freethreading and test subpackages). Other distributions and other Python branches should be checked against their own advisories.

How to check if you're exposed

The bug is reachable only where code extracts a tar archive. Find those places:

python3 --version
grep -rnE "tarfile\.open|extractall\(|\.extract\(|shutil\.unpack_archive" --include=*.py .
grep -rn "filter=" --include=*.py . | grep -i tar

A hit on extractall of an archive you built yourself is low risk. A hit on user uploads, downloaded artifacts or package contents is the case that matters. The filter argument (filter="data") is the safety net this bug bypasses, so a hit with a filter still needs the patch.

What to do now

  1. Update the Python package from your distribution and rebuild images.
  2. Rank the extraction sites by who controls the archive. Uploads and third party downloads first.
  3. Extract into a fresh temporary directory owned by a low privilege user, and never run the extraction as root.

How this could have been avoided

  • Extract in a sandbox directory with a restricted user. A path escape then lands somewhere that user cannot write.
  • Verify archive hashes before extracting. If the archive must match a known digest, a crafted one is rejected first.
  • Prefer the data filter, and treat it as one layer. It narrows the damage but this CVE shows it can be bypassed, so combine it with the controls above.

Why it matters

Archive extraction is a classic path traversal (CWE-22) source, and the standard library filter was the fix. A bypass of the fix is a reminder to keep the other layers. Reachability analysis helps: only code that calls tar extraction on untrusted input is exposed.

Quick check

Why is a tarfile filter bypass irrelevant to code that never extracts archives?

The flaw lives in the extraction path. If no code calls it, the vulnerable function is not reachable, though the package should still be updated.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.