Vulnerability · Published Aug 31, 2021 · Assigned by GitHub_M

CVE-2021-37712Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning using symbolic links

High 8.2

In plain English

A high-severity path traversal in node-tar from npm. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 1.9% (higher than 79% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)8.2High
Exploit odds (30 days)1.9%top 20.6% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack toolingNoneno public tooling known

Official description

The npm package "tar" (aka node-tar) before versions 4.4.18, 5.0.10, and 6.1.9 has an arbitrary file creation/overwrite and arbitrary code execution vulnerability. node-tar aims to guarantee that any file whose location would be modified by a symbolic link is not extracted. This is, in part, achieved by ensuring that extracted directories are not symlinks. Additionally, in order to prevent unnecessary stat calls to determine whether a given path is a directory, paths are cached when directories are created. This logic was insufficient when extracting tar files that contained both a directory and a symlink with names containing unicode values that normalized to the same value. Additionally, on Windows systems, long path portions would resolve to the same file system entities as their 8.3 "short path" counterparts. A specially crafted tar archive could thus include a directory with one form of the path, followed by a symbolic link with a different string that resolves to the same file system entity, followed by a file using the first form. By first creating a directory, and then replacing that directory with a symlink that had a different apparent name that resolved to the same entry in the filesystem, it was thus possible to bypass node-tar symlink checks on directories, essentially allowing an untrusted tar file to symlink into an arbitrary location and subsequently extracting arbitrary files into that location, thus allowing arbitrary file creation and overwrite. These issues were addressed in releases 4.4.18, 5.0.10 and 6.1.9. The v3 branch of node-tar has been deprecated and did not receive patches for these issues. If you are still using a v3 release we recommend you update to a more recent version of node-tar. If this is not possible, a workaround is available in the referenced GHSA-qq89-hq3f-393p.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:8nodejs1:14.18.2-2.module_el8.5.0+254+b4526b16ALSA-2022:0350
AlmaLinux:8nodejs1:14.18.2-2.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux:8nodejs-devel1:14.18.2-2.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux:8nodejs-devel1:14.18.2-2.module_el8.5.0+254+b4526b16ALSA-2022:0350
AlmaLinux:8nodejs-docs1:14.18.2-2.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux:8nodejs-docs1:14.18.2-2.module_el8.5.0+254+b4526b16ALSA-2022:0350
AlmaLinux:8nodejs-full-i18n1:14.18.2-2.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux:8nodejs-full-i18n1:14.18.2-2.module_el8.5.0+254+b4526b16ALSA-2022:0350
AlmaLinux:8nodejs-nodemon2.0.15-1.module_el8.6.0+2904+f21ad6f4ALSA-2022:0350
AlmaLinux:8nodejs-nodemon2.0.15-1.module_el8.5.0+2605+45d748afALSA-2022:0350
AlmaLinux:8nodejs-nodemon2.0.15-1.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux:8nodejs-packaging23-3.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux:8nodejs-packaging23-3.module_el8.4.0+2522+3bd42762ALSA-2022:0350
AlmaLinux:8npm1:6.14.15-1.14.18.2.2.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux:8npm1:6.14.15-1.14.18.2.2.module_el8.5.0+254+b4526b16ALSA-2022:0350
Alpine:v3.20nodejs14.17.6-r0ALPINE-CVE-2021-37712
Alpine:v3.21nodejs14.17.6-r0ALPINE-CVE-2021-37712
Alpine:v3.22nodejs14.17.6-r0ALPINE-CVE-2021-37712
Alpine:v3.23nodejs14.17.6-r0ALPINE-CVE-2021-37712
Alpine:v3.24nodejs14.17.6-r0ALPINE-CVE-2021-37712
Debian:12node-tar6.1.11+~cs11.3.10-1DEBIAN-CVE-2021-37712
Debian:13node-tar6.1.11+~cs11.3.10-1DEBIAN-CVE-2021-37712
Debian:14node-tar6.1.11+~cs11.3.10-1DEBIAN-CVE-2021-37712
Rocky Linux:8nodejs1:14.18.2-2.module+el8.5.0+733+de4fee6cRLSA-2022:0350
Rocky Linux:8nodejs-nodemon0:2.0.15-1.module+el8.5.0+721+4c107270RLSA-2022:0350
Rocky Linux:8nodejs-packaging0:23-3.module+el8.3.0+100+234774f7RLSA-2022:0350
Rocky Linux:8nodejs-packaging0:23-3.module+el8.7.0+1071+4bdda2a8RLSA-2022:0350
Rocky Linux:8nodejs-packaging0:23-3.module+el8.5.0+733+de4fee6cRLSA-2022:0350
Ubuntu:22.04:LTSnode-tarno fix listedUBUNTU-CVE-2021-37712
Ubuntu:24.04:LTSnode-tarno fix listedUBUNTU-CVE-2021-37712
Ubuntu:25.10node-tarno fix listedUBUNTU-CVE-2021-37712
Ubuntu:26.04:LTSnode-tarno fix listedUBUNTU-CVE-2021-37712
Ubuntu:26.10node-tarno fix listedUBUNTU-CVE-2021-37712
npmtar4.4.18GHSA-qq89-hq3f-393p
npmtar5.0.10GHSA-qq89-hq3f-393p
npmtar6.1.9GHSA-qq89-hq3f-393p

Affected products (as reported)

VendorProductVersions
npm node-tar < 4.4.18>= 5.0.0, < 5.0.10>= 6.0.0, < 6.1.9

Weakness: CWE-22, CWE-59 · Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N

References