GNU Tar through 1.35 allows file overwrite via directory traversal in crafted TAR archives, with a certain two-step process. First, the victim must extract an archive that contains a ../ symlink to a critical directory. Second, the victim must extract an archive that contains a critical file, specified via a relative pathname that begins with the symlink name and ends with that critical files name. Here, the extraction follows the symlink and overwrites the critical file. This bypasses the protection mechanism of Member name contains .. that would occur for a single TAR archive that attempted to specify the critical file via a ../ approach. For example, the first archive can contain x -> ../../../../../home/victim/.ssh and the second archive can contain x/authorized_keys. This can affect server applications that automatically extract any number of user-supplied TAR archives, and were relying on the blocking of traversal. This can also affect software installation processes in which tar xf is run more than once (e.g., when installing a package can automatically install two dependencies that are set up as untrusted tarballs instead of official packages). NOTE: the official GNU Tar manual has an otherwise-empty directory for each tar xf in its Security Rules of Thumb; however, third-party advice leads users to run tar xf more than once into the same directory.
The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize “../” sequences that can resolve to a location that is outside of that directory.
| Name | Vendor | Start Version | End Version |
|---|---|---|---|
| Tar | Gnu | * | 1.35 (excluding) |
| Red Hat Enterprise Linux 10 | RedHat | tar-2:1.35-9.el10_1 | * |
| Red Hat Enterprise Linux 10.0 Extended Update Support | RedHat | tar-2:1.35-7.el10_0.2 | * |
| Red Hat Enterprise Linux 9 | RedHat | tar-2:1.34-9.el9_7 | * |
| Tar | Ubuntu | devel | * |
| Tar | Ubuntu | esm-infra-legacy/trusty | * |
| Tar | Ubuntu | esm-infra/bionic | * |
| Tar | Ubuntu | esm-infra/focal | * |
| Tar | Ubuntu | esm-infra/xenial | * |
| Tar | Ubuntu | jammy | * |
| Tar | Ubuntu | noble | * |
| Tar | Ubuntu | plucky | * |
| Tar | Ubuntu | questing | * |
This allows attackers to traverse the file system to access files or directories that are outside of the restricted directory. The “../” manipulation is the canonical manipulation for operating systems that use “/” as directory separators, such as UNIX- and Linux-based systems. In some cases, it is useful for bypassing protection schemes in environments for which “/” is supported but not the primary separator, such as Windows, which uses “" but can also accept “/”.