CVE-2026-137507 in torchvisioninfo

Summary

by MITRE • 11/26/2026

torchvision before 0.29.2 contains a path traversal vulnerability in _extract_tar() that allows attackers to write files outside the extraction directory by supplying crafted tar archives. Attackers controlling archives passed to extract_archive() or download_and_extract_archive() can use .. paths, absolute paths, or symlinks to overwrite Python modules and achieve code execution.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 11/26/2026

The vulnerability identified in torchvision versions prior to 0.29.2 represents a critical path traversal flaw within the _extract_tar function, which is utilized by higher-level APIs such as extract_archive and download_and_extract_archive. This security defect stems from insufficient validation of file paths contained within tar archives before they are written to the local filesystem. When an archive contains entries with maliciously crafted relative paths utilizing double-dot sequences like .. or absolute path specifications, the extraction logic fails to canonicalize these paths against a designated base directory. Consequently, files can be extracted outside the intended target folder, effectively bypassing sandboxing mechanisms that rely on restricting file operations to specific directories. This behavior aligns directly with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, as the application does not adequately restrict access to resources within restricted directories or folders.

The operational impact of this vulnerability is severe because it allows an attacker who controls the input archive to achieve arbitrary file write capabilities on the host system. By overwriting critical Python modules located in site-packages or other import paths, an attacker can inject malicious code that will be executed whenever those modules are imported by legitimate applications using torchvision. This mechanism facilitates remote code execution without requiring direct shell access or authentication if the affected library is part of a server-side processing pipeline handling untrusted data. The use of symlinks further exacerbates this risk, as symbolic links created during extraction can point to sensitive system files, allowing an attacker to overwrite configuration files, scripts, or binaries with arbitrary content. This scenario corresponds to CWE-59: Improper Link Resolution Before File Access, commonly known as a symlink attack, which is frequently exploited in conjunction with path traversal vulnerabilities to escalate privileges or persist malicious code on the target machine.

From a threat intelligence perspective, this vulnerability enables techniques documented in the MITRE ATT&CK framework under T1036: Masquerading and potentially T1553: Subvert Trust Controls if used to modify security configurations. The ability to overwrite Python modules is particularly dangerous because it allows for stealthy persistence; since the malicious code resides within standard library paths, it may evade basic file integrity monitoring that does not specifically track changes in site-packages directories. Furthermore, this flaw impacts any workflow involving automated data ingestion pipelines where datasets are downloaded and extracted automatically from potentially untrusted sources such as public repositories or user uploads. The lack of strict path normalization means that even well-intentioned scripts processing external archives become vectors for compromise if the archive contents are manipulated by a malicious actor.

Mitigation requires immediate upgrading to torchvision version 0.29.2 or later, where this issue has been resolved through rigorous input validation and canonicalization checks before file system operations occur. Developers should also implement defensive coding practices such as verifying that all extracted files reside within the expected base directory after path resolution using os.path.realpath or equivalent secure functions in their respective languages. Additionally, running extraction processes with restricted permissions can limit the blast radius of any successful exploitation attempt by preventing writes to critical system directories like /usr/lib/python3 or similar site-packages locations where Python modules are typically stored. Organizations processing untrusted archives should consider isolating these operations within containers or virtual machines with minimal filesystem access to further reduce risk exposure until all instances of the vulnerable library version have been patched and updated across their infrastructure.

Responsible

VulnCheck

Reservation

11/26/2026

Disclosure

11/26/2026

Moderation

accepted

CPE

ready

EPSS

0.00688

KEV

no

Activities

very low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!