Path traversal in npm node-tar
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Partial Red Hat: 7 fixed, 7 without a fix
Attack profile from CVSS 3.1 · NVD. Fix status from CNA, GitHub and Red Hat.
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.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| npm | node-tar | before 4.4.16; 5.0.0 to before 5.0.8; 6.0.0 to before 6.1.7 | 4.4.16, 5.0.8, 6.1.7 | Patch available | CNA |
| — | tar (npm) | 3.0.0 to before 4.4.16 | 4.4.16 | Patch available | GHSA-9r2w-394v-53qc |
| — | tar (npm) | 5.0.0 to before 5.0.8 | 5.0.8 | Patch available | GHSA-9r2w-394v-53qc |
| — | tar (npm) | 6.0.0 to before 6.1.7 | 6.1.7 | Patch available | GHSA-9r2w-394v-53qc |
- node-tar Vendornpm Affected before 4.4.16; 5.0.0 to before 5.0.8; 6.0.0 to before 6.1.7 Fixed in 4.4.16, 5.0.8, 6.1.7 Patch available CNA
- tar (npm) Vendor— Affected 3.0.0 to before 4.4.16 Fixed in 4.4.16 Patch available GHSA-9r2w-394v-53qc
- tar (npm) Vendor— Affected 5.0.0 to before 5.0.8 Fixed in 5.0.8 Patch available GHSA-9r2w-394v-53qc
- tar (npm) Vendor— Affected 6.0.0 to before 6.1.7 Fixed in 6.1.7 Patch available GHSA-9r2w-394v-53qc
CPE configurations NVD · 6
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:npmjs:tar:*:*:*:*:*:node.js:*:* | before 4.4.16; 5.0.0 to before 5.0.8; 6.0.0 to before 6.1.7 | Vulnerable | Npmjs |
| cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* | 10.0 | Vulnerable | Debian |
| cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:* | 11.0 | Vulnerable | Debian |
| cpe:2.3:a:oracle:graalvm:20.3.3:*:*:*:enterprise:*:*:* | 20.3.3 | Vulnerable | Oracle |
| cpe:2.3:a:oracle:graalvm:21.2.0:*:*:*:enterprise:*:*:* | 21.2.0 | Vulnerable | Oracle |
| cpe:2.3:a:siemens:sinec_infrastructure_network_services:*:*:*:*:*:*:*:* | before 1.0.1.1 | Vulnerable | Siemens |
- cpe:2.3:a:npmjs:tar:*:*:*:*:*:node.js:*:* Versions before 4.4.16; 5.0.0 to before 5.0.8; 6.0.0 to before 6.1.7 Vulnerable ·Npmjs
- cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* Versions 10.0 Vulnerable ·Debian
- cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:* Versions 11.0 Vulnerable ·Debian
- cpe:2.3:a:oracle:graalvm:20.3.3:*:*:*:enterprise:*:*:* Versions 20.3.3 Vulnerable ·Oracle
- cpe:2.3:a:oracle:graalvm:21.2.0:*:*:*:enterprise:*:*:* Versions 21.2.0 Vulnerable ·Oracle
- cpe:2.3:a:siemens:sinec_infrastructure_network_services:*:*:*:*:*:*:*:* Versions before 1.0.1.1 Vulnerable ·Siemens
Remediation
- Fix · CNA node-tar (npm) Fixed in 4.4.16, 5.0.8, 6.1.7
- Fix · GHSA-9r2w-394v-53qc tar (npm) Fixed in 4.4.16 Advisory →
- Fix · GHSA-9r2w-394v-53qc tar (npm) Fixed in 5.0.8 Advisory →
- Fix · GHSA-9r2w-394v-53qc tar (npm) Fixed in 6.1.7 Advisory →
Red Hat 5 advisories
- RHSA-2022:4914 Released 2022-06-06 · Red Hat rating Moderaterh-nodejs12-nodejs security, bug fix, and enhancement update
- Red Hat Software Collections for RHEL Workstation(v. 7) rh-nodejs12-nodejs-12.22.12-2.el7, rh-nodejs12-nodejs-devel-12.22.12-2.el7, rh-nodejs12-nodejs-docs-12.22.12-2.el7 +1
- Red Hat Software Collections for RHEL(v. 7) rh-nodejs12-nodejs-12.22.12-2.el7, rh-nodejs12-nodejs-devel-12.22.12-2.el7, rh-nodejs12-nodejs-docs-12.22.12-2.el7 +1
- RHSA-2022:0350 Released 2022-02-01 · Red Hat rating Moderatenodejs:14 security, bug fix, and enhancement update
- Red Hat Enterprise Linux AppStream (v. 8) nodejs-1:14.18.2-2.module+el8.5.0+13644+8d46dafd.aarch64::nodejs:14, nodejs-1:14.18.2-2.module+el8.5.0+13644+8d46dafd.ppc64le::nodejs:14, nodejs-1:14.18.2-2.module+el8.5.0+13644+8d46dafd.s390x::nodejs:14 +19
- RHSA-2022:0246 Released 2022-01-25 · Red Hat rating Moderatenodejs:14 security, bug fix, and enhancement update
- Red Hat Enterprise Linux AppStream EUS (v.8.4) nodejs-1:14.18.2-2.module+el8.4.0+13643+6c0ebf22.aarch64::nodejs:14, nodejs-1:14.18.2-2.module+el8.4.0+13643+6c0ebf22.ppc64le::nodejs:14, nodejs-1:14.18.2-2.module+el8.4.0+13643+6c0ebf22.s390x::nodejs:14 +19
Show 2 more Red Hat advisories
- RHSA-2022:0041 Released 2022-01-06 · Red Hat rating Moderaterh-nodejs14-nodejs and rh-nodejs14-nodejs-nodemon security update
- Red Hat Software Collections for RHEL Workstation(v. 7) rh-nodejs14-nodejs-14.18.2-1.el7, rh-nodejs14-nodejs-devel-14.18.2-1.el7, rh-nodejs14-nodejs-docs-14.18.2-1.el7 +2
- Red Hat Software Collections for RHEL(v. 7) rh-nodejs14-nodejs-14.18.2-1.el7, rh-nodejs14-nodejs-devel-14.18.2-1.el7, rh-nodejs14-nodejs-docs-14.18.2-1.el7 +2
- RHSA-2021:5086 Released 2021-12-13 · Red Hat rating ModerateRed Hat OpenShift Data Foundation 4.9.0 enhancement, security, and bug fix update
- Red Hat OpenShift Data Foundation 4.9 on RHEL-8 odf/odf-multicluster-rhel8-operator, odf4/cephcsi-rhel8, odf4/ocs-must-gather-rhel8 +12
Fixed in the same release
Records fixed by the same vendor advisory or release, as the CNA lists them.
- Advisory ·
npm node-tar — DSA-5008
2 records Highest priority Priority MEDIUM 2 MEDIUM
Other records, highest priority first
- TI-2021-15587 Path traversal in npm node-tarPriority MEDIUM 41
Vendor assessments
Red Hat
Red Hat rating: Moderate. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| OpenShift Service Mesh 2.0 | Affected | No fix yet |
| Red Hat 3scale API Management Platform 2 | Affected | No fix yet: Fix deferred |
| Red Hat Advanced Cluster Management for Kubernetes 2 | Affected | No fix planned: Will not fix |
| Red Hat OpenShift Container Platform 4 | Affected | No fix planned: Will not fix |
| Red Hat OpenShift GitOps | Affected | No fix yet |
| Red Hat OpenShift distributed tracing 2 | Affected | No fix yet |
| Red Hat Openshift Container Storage 4 | Affected | No fix yet |
| Red Hat Enterprise Linux AppStream (v. 8) | Fixed | RHSA-2022:0350 |
| Red Hat Enterprise Linux AppStream E4S (v. 8.1) | Fixed | — |
| Red Hat Enterprise Linux AppStream EUS (v. 8.2) | Fixed | — |
| Red Hat Enterprise Linux AppStream EUS (v.8.4) | Fixed | RHSA-2022:0246 |
| Red Hat OpenShift Data Foundation 4.9 on RHEL-8 | Fixed | RHSA-2021:5086 |
| Red Hat Software Collections for RHEL Workstation(v. 7) | Fixed | RHSA-2022:0041, RHSA-2022:4914 |
| Red Hat Software Collections for RHEL(v. 7) | Fixed | RHSA-2022:0041, RHSA-2022:4914 |
Not affected: 4 products
- Red Hat Advanced Cluster Management for Kubernetes 2
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- Red Hat Fuse 7
Timeline
- 2026-10-02 Threatist record created from CVE-2021-37701
- 2026-10-03 Alias added: GHSA-9r2w-394v-53qc
References
Patch 3
Advisory 4
Sources
- CVE-2021-37701 · CVE Program
- CVE-2021-37701 · NVD
- FIRST EPSS
- GHSA-9r2w-394v-53qc · GitHub Advisory Database · CC BY 4.0
- CVE-2021-37701 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences