CVEfocus › CVE database › CVE-2021-37712

CVE-2021-37712Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory…

CVSS 8.2 HighEPSS 1.9% (higher than 80% of CVEs)Published 2021-08-31Updated 2024-08-04Assigner: GitHub_M

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.

CWE-22CWE-59

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

35Fixed
3Fix pending
3Under investigation
3Will not fix
9Not affected

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.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.10node-tarFix pendingUBUNTU-CVE-2021-37712
Ubuntu 26.04node-tarUnder investigationUBUNTU-CVE-2021-37712
Ubuntu 25.10node-tarWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2021-37712
Ubuntu 24.04node-tarUnder investigationUBUNTU-CVE-2021-37712
Ubuntu 22.04node-tarUnder investigationUBUNTU-CVE-2021-37712
Ubuntu 20.04node-tarFix pendingUBUNTU-CVE-2021-37712
Ubuntu 18.04node-tarWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2021-37712
Ubuntu 16.04node-tarWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2021-37712
Ubuntu 14.04node-tarFix pendingUBUNTU-CVE-2021-37712
Debian 14node-tarFixed6.1.11+~cs11.3.10-1DEBIAN-CVE-2021-37712
Debian 13node-tarFixed6.1.11+~cs11.3.10-1DEBIAN-CVE-2021-37712
Debian 12node-tarFixed6.1.11+~cs11.3.10-1DEBIAN-CVE-2021-37712
Red Hat Enterprise Linux 9nodejsNot affected
Red Hat Enterprise Linux 9nodejs-docsNot affected
Red Hat Enterprise Linux 9nodejs-full-i18nNot affected
Red Hat Enterprise Linux 9nodejs-libsNot affected
Red Hat Enterprise Linux 9npmNot affected
Red Hat Enterprise Linux 8nodejsFixed1:14.18.2-2.module+el8.5.0+13644+8d46dafdRHEA-2022:5139
Red Hat Enterprise Linux 8nodejs-develFixed1:14.18.2-2.module+el8.5.0+13644+8d46dafdRHEA-2022:5139
Red Hat Enterprise Linux 8nodejs-docsFixed1:14.18.2-2.module+el8.5.0+13644+8d46dafdRHEA-2022:5139
Red Hat Enterprise Linux 8nodejs-full-i18nFixed1:14.18.2-2.module+el8.5.0+13644+8d46dafdRHEA-2022:5139
Red Hat Enterprise Linux 8nodejs-libsNot affected
Red Hat Enterprise Linux 8nodejs-nodemonFixed0:2.0.15-1.module+el8.5.0+13504+a2e74d91RHEA-2022:5139
Red Hat Enterprise Linux 8nodejs-packagingFixed0:17-3.module+el8.1.0+3369+37ae6a45RHSA-2022:0350
Red Hat Enterprise Linux 8nodejs-packaging-bundlerNot affected
Red Hat Enterprise Linux 8npmFixed1:6.14.15-1.14.18.2.2.module+el8.5.0+13644+8d46dafdRHEA-2022:5139
Red Hat Enterprise Linux 8v8-12.4-develNot affected
Red Hat Enterprise Linux 8v8-13.6-develNot affected
AlmaLinux 8nodejsFixed1:14.18.2-2.module_el8.5.0+254+b4526b16ALSA-2022:0350
AlmaLinux 8nodejs-develFixed1:14.18.2-2.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux 8nodejs-docsFixed1:14.18.2-2.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux 8nodejs-full-i18nFixed1:14.18.2-2.module_el8.5.0+2618+8d46dafdALSA-2022:0350
AlmaLinux 8nodejs-nodemonFixed2.0.15-1.module_el8.5.0+2605+45d748afALSA-2022:0350
AlmaLinux 8nodejs-packagingFixed23-3.module_el8.4.0+2522+3bd42762ALSA-2022:0350
AlmaLinux 8npmFixed1:6.14.15-1.14.18.2.2.module_el8.5.0+2618+8d46dafdALSA-2022:0350
Rocky Linux 8nodejsFixed1:14.18.2-2.module+el8.5.0+733+de4fee6cRLSA-2022:0350
Rocky Linux 8nodejs-nodemonFixed0:2.0.15-1.module+el8.5.0+721+4c107270RLSA-2022:0350
Rocky Linux 8nodejs-packagingFixed0:23-3.module+el8.3.0+100+234774f7RLSA-2022:0350
Alpine Linux 3.24nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.23nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.22nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.21nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.20nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.19nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.18nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.17nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.16nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.15nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.14nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.13nodejsFixed14.17.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.12nodejsFixed12.22.6-r0ALPINE-CVE-2021-37712
Alpine Linux 3.11nodejsFixed12.22.6-r0ALPINE-CVE-2021-37712
npm librarytarFixed4.4.18GHSA-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.

Vendor advisories:

References

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.