/

CVE-2026-65320

Severity:

HIGH RISK

(8.1)

Archive Path Traversal (CWE-22) in fastcore untar_dir()

CVE-2026-65320

Received

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

fastcore's untar_dir() helper can extract tar archive members outside the intended destination when given a crafted archive. If an application extracts untrusted archives using this helper on affected Python runtimes, files writable by the application may be overwritten.

Affected context

The issue concerns applications using fastcore.xtras.untar_dir() to extract tar archives. The risk arises when an attacker can supply or influence an archive that the application extracts, and extraction does not enforce safe member paths or destination containment. The described behavior applies on Python versions before 3.14.

Exploit preconditions

  • Attack surface: Application functionality that extracts tar archives through untar_dir()
  • Required access: Ability to provide or influence an archive that the application processes
  • Trigger point: Archive extraction via the helper
  • Why exploitation is possible: Archive member paths are not filtered or checked to ensure their resolved destinations remain inside the intended extraction directory

Why this happens

The extraction path passes archive data to shutil.unpack_archive() without applying a tar extraction filter, validating member paths, or checking containment. This is an improper limitation of a pathname to a restricted directory, mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). As a result, archive members may resolve outside the intended extraction location.

Potential impact

  • Application files or configuration may be overwritten.
  • Importable code may be replaced, which could lead to code execution when that code is later loaded.
  • Data may be modified or made unavailable.
  • The application or host may experience denial of service.

General mitigation guidance

Defensive patterns focus on treating archives as untrusted input and constraining extraction:

  • Use extraction APIs or filters that reject unsafe archive members by default.
  • Validate each member path and confirm its resolved destination remains within the intended extraction directory.
  • Avoid extracting untrusted archives where possible; otherwise, extract into an isolated, restricted location.
  • Run extraction with least-privilege permissions and limit which files and directories the process can write.
  • Apply resource limits and validate expected archive contents before making extracted files available to the application.

How teams detect issues like this

Look for archive extraction helpers that process untrusted data without safe filters, member-path validation, or destination containment checks. Code review and static analysis can flag calls to untar_dir() and archive APIs, then verify that paths are constrained before files are written. Policy checks can require safe extraction behavior and restrict archive-processing services to least-privilege filesystem access.

Sources

SourceLink
github.comgithub.com/AnswerDotAI/fastcore/issues/974
github.comgithub.com/AnswerDotAI/fastcore/pull/973
github.comgithub.com/rahulreddykarne/CVE-2026-65320-fastcore
vulncheck.comvulncheck.com/advisories/fastcore-through-2.2.44-path-traversal-via-untar-dir-tar-extraction

Frequently asked

questions

The issue is relevant when an application uses untar_dir() to extract an attacker-supplied or attacker-influenced tar archive without effective path containment.

An attacker must be able to provide or influence an archive that the application processes. The specific access route depends on how the application accepts and handles archives.

Use safe extraction behavior and ensure every member's resolved destination stays within the designated extraction directory.

Treat archives as untrusted input, enforce path and content policies before writing files, isolate extraction, and limit the process's filesystem privileges.

Find out what's already
exploitable in your codebase.