Intel

AIKIDO-2026-574935

tarsafe is vulnerable to Path Traversal

Path TraversalGHSA-58r7-5cr4-4ffr Published 3 days ago

81

High Risk

This Affects:

PYTHONtarsafe
0.0.1 - 0.0.5
Fixed in 0.0.6
Are you affected? Scan for Free

TL;DR

TarSafe.extractall() and TarSafe.extract() validate archive members by comparing the resolved member path against the extraction root with a plain string prefix comparison instead of a real path-boundary check. A member whose resolved path merely starts with the same characters as the root, such as a sibling directory, passes the check and is written outside the intended directory. On Windows a pre-filter keyed on the host path separator never runs the containment check for members that use the POSIX-style names required by the tar format, so absolute or drive-relative member names escape as well. Because the library is a drop-in safe replacement used specifically to extract untrusted archives, a crafted archive can write files outside the extraction directory; the fix replaces the prefix comparison with a true path-containment check anchored to the directory actually being extracted into.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you use it to extract untrusted or externally supplied tar archives.

Background info

tarsafe is vulnerable to Path Traversal in versions 0.0.1 - 0.0.5.

How to fix this

Upgrade the tarsafe library to the patch version.