CVE-2021-37712Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory…
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.
What to do
Fixed builds are available from AlmaLinux, Alpine, Debian, Red Hat, Rocky Linux, npm: see the table below for the fixed version per release.
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.10 | node-tar | Fix pending | UBUNTU-CVE-2021-37712 | |
| Ubuntu 26.04 | node-tar | Under investigation | UBUNTU-CVE-2021-37712 | |
| Ubuntu 25.10 | node-tar | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2021-37712 | |
| Ubuntu 24.04 | node-tar | Under investigation | UBUNTU-CVE-2021-37712 | |
| Ubuntu 22.04 | node-tar | Under investigation | UBUNTU-CVE-2021-37712 | |
| Ubuntu 20.04 | node-tar | Fix pending | UBUNTU-CVE-2021-37712 | |
| Ubuntu 18.04 | node-tar | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2021-37712 | |
| Ubuntu 16.04 | node-tar | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2021-37712 | |
| Ubuntu 14.04 | node-tar | Fix pending | UBUNTU-CVE-2021-37712 | |
| Debian 14 | node-tar | Fixed | 6.1.11+~cs11.3.10-1 | DEBIAN-CVE-2021-37712 |
| Debian 13 | node-tar | Fixed | 6.1.11+~cs11.3.10-1 | DEBIAN-CVE-2021-37712 |
| Debian 12 | node-tar | Fixed | 6.1.11+~cs11.3.10-1 | DEBIAN-CVE-2021-37712 |
| Red Hat Enterprise Linux 9 | nodejs | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs-docs | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs-full-i18n | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs-libs | Not affected | ||
| Red Hat Enterprise Linux 9 | npm | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs | Fixed | 1:14.18.2-2.module+el8.5.0+13644+8d46dafd | RHEA-2022:5139 |
| Red Hat Enterprise Linux 8 | nodejs-devel | Fixed | 1:14.18.2-2.module+el8.5.0+13644+8d46dafd | RHEA-2022:5139 |
| Red Hat Enterprise Linux 8 | nodejs-docs | Fixed | 1:14.18.2-2.module+el8.5.0+13644+8d46dafd | RHEA-2022:5139 |
| Red Hat Enterprise Linux 8 | nodejs-full-i18n | Fixed | 1:14.18.2-2.module+el8.5.0+13644+8d46dafd | RHEA-2022:5139 |
| Red Hat Enterprise Linux 8 | nodejs-libs | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs-nodemon | Fixed | 0:2.0.15-1.module+el8.5.0+13504+a2e74d91 | RHEA-2022:5139 |
| Red Hat Enterprise Linux 8 | nodejs-packaging | Fixed | 0:17-3.module+el8.1.0+3369+37ae6a45 | RHSA-2022:0350 |
| Red Hat Enterprise Linux 8 | nodejs-packaging-bundler | Not affected | ||
| Red Hat Enterprise Linux 8 | npm | Fixed | 1:6.14.15-1.14.18.2.2.module+el8.5.0+13644+8d46dafd | RHEA-2022:5139 |
| Red Hat Enterprise Linux 8 | v8-12.4-devel | Not affected | ||
| Red Hat Enterprise Linux 8 | v8-13.6-devel | Not affected | ||
| AlmaLinux 8 | nodejs | Fixed | 1:14.18.2-2.module_el8.5.0+254+b4526b16 | ALSA-2022:0350 |
| AlmaLinux 8 | nodejs-devel | Fixed | 1:14.18.2-2.module_el8.5.0+2618+8d46dafd | ALSA-2022:0350 |
| AlmaLinux 8 | nodejs-docs | Fixed | 1:14.18.2-2.module_el8.5.0+2618+8d46dafd | ALSA-2022:0350 |
| AlmaLinux 8 | nodejs-full-i18n | Fixed | 1:14.18.2-2.module_el8.5.0+2618+8d46dafd | ALSA-2022:0350 |
| AlmaLinux 8 | nodejs-nodemon | Fixed | 2.0.15-1.module_el8.5.0+2605+45d748af | ALSA-2022:0350 |
| AlmaLinux 8 | nodejs-packaging | Fixed | 23-3.module_el8.4.0+2522+3bd42762 | ALSA-2022:0350 |
| AlmaLinux 8 | npm | Fixed | 1:6.14.15-1.14.18.2.2.module_el8.5.0+2618+8d46dafd | ALSA-2022:0350 |
| Rocky Linux 8 | nodejs | Fixed | 1:14.18.2-2.module+el8.5.0+733+de4fee6c | RLSA-2022:0350 |
| Rocky Linux 8 | nodejs-nodemon | Fixed | 0:2.0.15-1.module+el8.5.0+721+4c107270 | RLSA-2022:0350 |
| Rocky Linux 8 | nodejs-packaging | Fixed | 0:23-3.module+el8.3.0+100+234774f7 | RLSA-2022:0350 |
| Alpine Linux 3.24 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.23 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.22 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.21 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.20 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.19 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.18 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.17 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.16 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.15 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.14 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.13 | nodejs | Fixed | 14.17.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.12 | nodejs | Fixed | 12.22.6-r0 | ALPINE-CVE-2021-37712 |
| Alpine Linux 3.11 | nodejs | Fixed | 12.22.6-r0 | ALPINE-CVE-2021-37712 |
| npm library | tar | Fixed | 4.4.18 | GHSA-qq89-hq3f-393p |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- npm node-tar: affected: < 4.4.18, >= 5.0.0, < 5.0.10, >= 6.0.0, < 6.1.9
Vendor advisories:
- https://www.debian.org/security/2021/dsa-5008 (vendor-advisory)
References
- https://www.npmjs.com/package/tar
- https://github.com/npm/node-tar/security/advisories/GHSA-qq89-hq3f-393p
- https://www.oracle.com/security-alerts/cpuoct2021.html
- https://www.debian.org/security/2021/dsa-5008
- https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf
- https://lists.debian.org/debian-lts-announce/2022/12/msg00023.html
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.