Skip to content
Fencer Vulns
high 8.2

CVE-2021-37701 json

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

published 2021-08-31 5 y ago modified 2026-07-08 4 mo ago also GHSA-9r2w-394v-53qc , EUVD-2021-1668

cvss
8.2
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
3.3%
EPSS 3.3% chance of exploitation in 30 days, percentile 88%
public exploits
0
none known

Summary

The npm package "tar" (aka node-tar) before versions 4.4.16, 5.0.8, and 6.1.7 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 the same name as the directory, where the symlink and directory names in the archive entry used backslashes as a path separator on posix systems. The cache checking logic used both `\` and `/` characters as path separators, however `\` is a valid filename character on posix systems. By first creating a directory, and then replacing that directory with a symlink, 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. Additionally, a similar confusion could arise on case-insensitive filesystems. If a tar archive contained a directory at `FOO`, followed by a symbolic link named `foo`, then on case-insensitive file systems, the creation of the symbolic link would remove the directory from the filesystem, but _not_ from the internal directory cache, as it would not be treated as a cache hit. A subsequent file entry within the `FOO` directory would then be placed in the target of the symbolic link, thinking that the directory had already been created. These issues were addressed in releases 4.4.16, 5.0.8 and 6.1.7. 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-9r2w-394v-53qc.

Patch / fix

  • npm tar 4.4.16, 5.0.8, 6.1.7
  • npmjs tar 4.4.16, 5.0.8, 6.1.7
  • siemens sinec_infrastructure_network_services 1.0.1.1
  • node-tar Debian 14, Debian 13, Debian 12 6.1.7+~cs11.3.10-1

debian advisories DEBIAN-CVE-2021-37701

  • npm RHEL 8 1:6.14.15-1.14.18.2.2.module+el8.5.0+13644+8d46dafd
  • nodejs RHEL 8 1:14.18.2-2.module+el8.5.0+13644+8d46dafd
  • nodejs-nodemon RHEL 8 2.0.15-1.module+el8.5.0+13504+a2e74d91
  • nodejs-full-i18n RHEL 8 1:14.18.2-2.module+el8.5.0+13644+8d46dafd
  • nodejs-packaging RHEL 8, RHEL 8.4 EUS 23-3.module+el8.3.0+6519+9f98ed83
  • npm RHEL 8 1:6.14.16-1.12.22.12.1.module+el8.6.0+15324+1f2c5d8d
  • nodejs RHEL 8 1:12.22.12-1.module+el8.6.0+15324+1f2c5d8d
  • nodejs-nodemon RHEL 8, RHEL 8.4 EUS 2.0.3-1.module+el8.4.0+11732+c668cc9f

red hat advisories RHSA-2022:0350RHSA-2022:0246RHEA-2022:5139RHEA-2022:5221RHEA-2022:5615RHEA-2022:4925

  • nodejs12 SLE Module for Web and Scripting 12 12.22.9-1.38.1
  • nodejs14 SLE Module for Web and Scripting 15 SP3, SLE Module for Web and Scripting 15 SP2 14.18.1-15.21.2
  • nodejs12 SLE Module for Web and Scripting 15 SP3, SLE Module for Web and Scripting 15 SP2 12.22.7-4.22.1
  • nodejs14 SLE Module for Web and Scripting 12 14.18.1-6.18.2

suse advisories SUSE-SU-2022:0101-1SUSE-SU-2021:3964-1SUSE-SU-2021:3940-1SUSE-SU-2021:3886-1

  • nodejs14 openSUSE Tumbleweed 14.18.1-1.1
  • nodejs12 openSUSE Leap 15.2 12.22.7-lp152.3.21.1
  • nodejs14 openSUSE Leap 15.2 14.18.1-lp152.17.1
  • nodejs14 openSUSE Leap 15.3 14.18.1-15.21.2
  • nodejs12 openSUSE Leap 15.3 12.22.7-4.22.1

opensuse advisories openSUSE-SU-2024:11616-1openSUSE-SU-2021:1574-1openSUSE-SU-2021:1552-1openSUSE-SU-2021:3964-1openSUSE-SU-2021:3940-1

  • npm AlmaLinux 8 1:6.14.15-1.14.18.2.2.module_el8.5.0+2618+8d46dafd
  • npm AlmaLinux 8 1:6.14.15-1.14.18.2.2.module_el8.5.0+254+b4526b16
  • nodejs AlmaLinux 8 1:14.18.2-2.module_el8.5.0+2618+8d46dafd
  • nodejs AlmaLinux 8 1:14.18.2-2.module_el8.5.0+254+b4526b16
  • nodejs-nodemon AlmaLinux 8 2.0.15-1.module_el8.6.0+2904+f21ad6f4
  • nodejs-nodemon AlmaLinux 8 2.0.15-1.module_el8.5.0+2605+45d748af
  • nodejs-nodemon AlmaLinux 8 2.0.15-1.module_el8.5.0+2618+8d46dafd
  • nodejs-full-i18n AlmaLinux 8 1:14.18.2-2.module_el8.5.0+2618+8d46dafd

almalinux advisories ALSA-2022:0350

  • nodejs Rocky Linux 8 1:14.18.2-2.module+el8.5.0+733+de4fee6c
  • nodejs-nodemon Rocky Linux 8 2.0.15-1.module+el8.5.0+721+4c107270
  • nodejs-packaging Rocky Linux 8 23-3.module+el8.7.0+1071+4bdda2a8
  • nodejs-packaging Rocky Linux 8 23-3.module+el8.3.0+100+234774f7
  • nodejs-packaging Rocky Linux 8 23-3.module+el8.5.0+733+de4fee6c

rocky linux advisories RLSA-2022:0350

  • nodejs Alpine 3.12, Alpine 3.11 12.22.6-r0
  • nodejs Alpine 3.24, Alpine 3.23, Alpine 3.22 +9 more 14.17.6-r0

alpine advisories ALPINE-CVE-2021-37701

Alpine secdb © Alpine Linux, from https://secdb.alpinelinux.org via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2021-37701 updated cvss 8.1

nodejs-tar: Insufficient symlink protection due to directory cache poisoning using symbolic links allowing arbitrary file creation and overwrite

  • Red Hat OpenShift Service Mesh 2.0 servicemesh-grafana, servicemesh-prometheus, servicemesh-grafana-prometheus
    affected: no fix available
  • Red Hat 3scale API Management Platform 2 system
    affected: no fix available “Fix deferred”
  • Red Hat Advanced Cluster Management for Kubernetes 2 rhacm2/console-rhel8, rhacm2/search-ui-rhel8, rhacm2/mcm-topology-rhel8, rhacm2/console-header-rhel8 Red Hat OpenShift Container Platform 4 openshift4/ose-grafana
    affected: no fix planned “Will not fix”
  • Red Hat Openshift Container Storage 4 ocs4/mcg-core-rhel8 Red Hat OpenShift distributed tracing 2 rhosdt/jaeger-all-in-one-rhel8 Red Hat OpenShift GitOps openshift-gitops-1/argocd-rhel8
    affected: no fix available
  • Red Hat Enterprise Linux AppStream (v. 8) nodejs 14.18.2-2.module+el8.5.0+13644+8d46dafd, nodejs 12.22.12-1.module+el8.6.0+15324+1f2c5d8d, nodejs-packaging 17-3.module+el8.1.0+3369+37ae6a45, nodejs-packaging 23-3.module+el8.3.0+6519+9f98ed83, nodejs-nodemon 2.0.3-1.module+el8.4.0+11732+c668cc9f, nodejs-nodemon 2.0.15-1.module+el8.5.0+13504+a2e74d91, +4 more
    fixed: vendor fix RHSA-2022:0350
  • Red Hat Enterprise Linux AppStream E4S (v. 8.1) nodejs 12.22.12-1.module+el8.1.0+15296+87b2f6ad, nodejs-packaging 17-3.module+el8.1.0+3369+37ae6a45, nodejs-nodemon 1.18.3-1.module+el8.1.0+3369+37ae6a45, npm 6.14.16-1.12.22.12.1.module+el8.1.0+15296+87b2f6ad, nodejs-full-i18n 12.22.12-1.module+el8.1.0+15296+87b2f6ad
    fixed: vendor fix RHEA-2022:4925
  • Red Hat Enterprise Linux AppStream EUS (v. 8.2) nodejs 12.22.12-1.module+el8.2.0+15322+a70ca0ab, nodejs-packaging 17-3.module+el8.1.0+3369+37ae6a45, nodejs-nodemon 1.18.3-1.module+el8.1.0+3369+37ae6a45, npm 6.14.16-1.12.22.12.1.module+el8.2.0+15322+a70ca0ab, nodejs-full-i18n 12.22.12-1.module+el8.2.0+15322+a70ca0ab
    fixed: vendor fix RHEA-2022:5221
  • Red Hat Enterprise Linux AppStream EUS (v.8.4) nodejs 14.18.2-2.module+el8.4.0+13643+6c0ebf22, nodejs 12.22.12-1.module+el8.4.0+15323+4d1cc445, nodejs-packaging 17-3.module+el8.1.0+3369+37ae6a45, nodejs-packaging 23-3.module+el8.3.0+6519+9f98ed83, nodejs-nodemon 2.0.3-1.module+el8.4.0+11732+c668cc9f, nodejs-nodemon 2.0.15-1.module+el8.4.0+13503+fc29810b, +4 more
    fixed: vendor fix RHEA-2022:5615
show 3 more
  • Red Hat OpenShift Data Foundation 4.9 on RHEL-8 odf4/ocs-operator-bundle 4.9.0-5, odf4/odf-operator-bundle 4.9.0-5, odf4/odr-hub-operator-bundle 4.9.0-5, odf4/odr-cluster-operator-bundle 4.9.0-5, odf4/odf-multicluster-operator-bundle 4.9.0-5, odf4/cephcsi-rhel8 4.9-164.57484e3.release_4.9, +9 more
    fixed: vendor fix RHSA-2021:5086
  • Red Hat Software Collections for RHEL Workstation(v. 7) rh-nodejs14-nodejs 14.18.2-1.el7, rh-nodejs12-nodejs 12.22.12-2.el7, rh-nodejs14-npm 6.14.15-14.18.2.1.el7, rh-nodejs12-npm 6.14.16-12.22.12.2.el7, rh-nodejs14-nodejs-nodemon 2.0.3-6.el7 Red Hat Software Collections for RHEL(v. 7) rh-nodejs14-nodejs 14.18.2-1.el7, rh-nodejs12-nodejs 12.22.12-2.el7, rh-nodejs14-npm 6.14.15-14.18.2.1.el7, rh-nodejs12-npm 6.14.16-12.22.12.2.el7, rh-nodejs14-nodejs-nodemon 2.0.3-6.el7
    fixed: vendor fix RHSA-2022:4914
  • Red Hat Advanced Cluster Management for Kubernetes 2 rhacm2/grc-ui-rhel8, rhacm2/console-ui-rhel8, rhacm2/application-ui-rhel8, rhacm2/kui-web-terminal-rhel8 Red Hat Enterprise Linux 8 npm, nodejs, nodejs-libs, nodejs-nodemon, nodejs-full-i18n, nodejs-packaging, +1 more Red Hat Enterprise Linux 9 npm, nodejs, nodejs-libs, nodejs-full-i18n Red Hat Fuse 7 tar-pack
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

Exploit prediction

3.29% chance of exploitation in the next 30 days, higher than 88% of all scored CVEs (FIRST EPSS, 2026-11-08).

CVSS scores

assigned by version score vector
CNA 3.1 8.2 CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N
NVD 3.1 8.6 CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
NVD 2.0 4.4 AV:L/AC:M/Au:N/C:P/I:P/A:P
GitHub 3.1 8.2 CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N

Affected packages

ecosystem package affected fixed in
npm tar
>=3.0.0, <4.4.16
>=5.0.0, <5.0.8
>=6.0.0, <6.1.7
4.4.16
5.0.8
6.1.7

Affected products

  • npm node-tar

Classification

Weakness
  • CWE-22 Improper Limitation of a Pathname to a Restricted Directory
  • CWE-59 Improper Link Resolution Before File Access

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.