Vulnerability in the Python module TarFile allows writing to any part of the file system

The standard Python module tarfile, which provides functions for reading and writing tar archives, has five identified vulnerabilities, one of which is rated critical. The vulnerabilities have been fixed in Python releases 3.13.4 and 3.12.11. The most dangerous vulnerability (CVE-2025-4517) allows for writing files to any part of the file system when unpacking a specially crafted archive. In system scripts using tarfile and running with root permissions (for example, in utilities for working with packages and isolated containers), this vulnerability can be exploited to escalate privileges or escape from an isolated container.

The vulnerability affects projects where the tarfile module is used to unpack untrusted tar archives, using the TarFile.extractall() or TarFile.extract() functions with the ‘filter=’ parameter set to ‘data’ or ‘tar’. The vulnerability is caused by improper handling of the ‘..’ sequence in link names. The issue affects Python versions starting from 3.12. The ‘filter=’data’‘ mode is applied by default in the Python 3.14 branch currently under development (release scheduled for fall).

Other vulnerabilities in TarFile:

  • CVE-2025-4330 — the possibility of bypassing the data extraction filter, which may lead to extracting a symbolic link from the archive pointing beyond the base directory where the unpacking is performed.
  • CVE-2025-4138 — the possibility of creating arbitrary symbolic links outside the base directory when unpacking archives with the ‘filter=’data’‘ parameter.
  • CVE-2024-12718 — the possibility of changing metadata (such as modification time) of files outside the base directory when unpacking archives with the ‘filter=’data’‘ parameter or permissions (chmod) when unpacking archives with the ‘filter=’tar’‘ parameter.
  • CVE-2025-4435 — if the TarFile.errorlevel parameter is set to 0 when unpacking an archive, elements of the archive that fall under the specified filter were unpacked instead of being ignored, contrary to the documentation.

Izvor: opennet.ru

Kupite zanesljivo gostovanje za spletne strani z zaščito pred DDoS, VPS VDS strežniki 🔥 Kupite zanesljivo gostovanje za spletne strani z zaščito pred DDoS, VPS VDS strežniki | ProHoster