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, 6 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.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.
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.18; 5.0.0 to before 5.0.10; 6.0.0 to before 6.1.9 | 4.4.18, 5.0.10, 6.1.9 | Patch available | CNA |
| — | tar (npm) | 3.0.0 to before 4.4.18 | 4.4.18 | Patch available | GHSA-qq89-hq3f-393p |
| — | tar (npm) | 5.0.0 to before 5.0.10 | 5.0.10 | Patch available | GHSA-qq89-hq3f-393p |
| — | tar (npm) | 6.0.0 to before 6.1.9 | 6.1.9 | Patch available | GHSA-qq89-hq3f-393p |
- node-tar Vendornpm Affected before 4.4.18; 5.0.0 to before 5.0.10; 6.0.0 to before 6.1.9 Fixed in 4.4.18, 5.0.10, 6.1.9 Patch available CNA
- tar (npm) Vendor— Affected 3.0.0 to before 4.4.18 Fixed in 4.4.18 Patch available GHSA-qq89-hq3f-393p
- tar (npm) Vendor— Affected 5.0.0 to before 5.0.10 Fixed in 5.0.10 Patch available GHSA-qq89-hq3f-393p
- tar (npm) Vendor— Affected 6.0.0 to before 6.1.9 Fixed in 6.1.9 Patch available GHSA-qq89-hq3f-393p
CPE configurations NVD · 7
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:npmjs:tar:*:*:*:*:*:node.js:*:* | up to 4.4.17; 5.0.0 – 5.0.9; 6.0.0 – 6.1.8 | Vulnerable | Npmjs |
| cpe:2.3:o:microsoft:windows:-:*:*:*:*:*:*:* | not specified by NVD | Running on | Microsoft |
| 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 up to 4.4.17; 5.0.0 – 5.0.9; 6.0.0 – 6.1.8 Vulnerable ·Npmjs
- cpe:2.3:o:microsoft:windows:-:*:*:*:*:*:*:* Versions not specified by NVD Running on ·Microsoft
- 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.18, 5.0.10, 6.1.9
- Fix · GHSA-qq89-hq3f-393p tar (npm) Fixed in 4.4.18 Advisory →
- Fix · GHSA-qq89-hq3f-393p tar (npm) Fixed in 5.0.10 Advisory →
- Fix · GHSA-qq89-hq3f-393p tar (npm) Fixed in 6.1.9 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-15576 Path traversal in npm node-tarPriority MEDIUM 43
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 yet |
| Red Hat OpenShift Container Platform 4 | Affected | No fix planned: Will not fix |
| Red Hat OpenShift GitOps | 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-37712
- 2026-10-03 Alias added: GHSA-qq89-hq3f-393p
References
Patch 3
Advisory 3
Other 8
- https://www.npmjs.com/package/tar
- https://github.com/isaacs/node-tar/commit/1739408d3122af897caefd09662bce2ea477533b
- https://github.com/isaacs/node-tar/commit/2f1bca027286c23e110b8dfc7efc10756fa3db5a
- https://github.com/isaacs/node-tar/commit/3aaf19b2501bbddb145d92b3322c80dcaed3c35f
- https://github.com/isaacs/node-tar/commit/b6162c7fafe797f856564ef37f4b82747f051455
- https://github.com/isaacs/node-tar/commit/bb93ba243746f705092905da1955ac3b0509ba1e
- https://github.com/isaacs/node-tar/commit/d56f790bda9fea807dd80c5083f24771dbdd6eb1
- https://github.com/npm/node-tar
Sources
- CVE-2021-37712 · CVE Program
- CVE-2021-37712 · NVD
- FIRST EPSS
- GHSA-qq89-hq3f-393p · GitHub Advisory Database · CC BY 4.0
- CVE-2021-37712 · 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