CVE-2021-37701
Summary
| CVE | CVE-2021-37701 |
|---|---|
| State | PUBLIC |
| Assigner | [email protected] |
| Source Priority | CVE Program / NVD first with legacy fallback |
| Published | 2021-08-31 17:15:00 UTC |
| Updated | 2023-01-19 20:11:00 UTC |
| Description | 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. |
Risk And Classification
Problem Types: CWE-22 | CWE-59
NVD Known Affected Configurations (CPE 2.3)
| Type | Vendor | Product | Version | Update | Edition | Language |
|---|---|---|---|---|---|---|
| Operating System | Debian | Debian Linux | 10.0 | All | All | All |
| Operating System | Debian | Debian Linux | 11.0 | All | All | All |
| Application | Npmjs | Tar | All | All | All | All |
| Application | Oracle | Graalvm | 20.3.3 | All | All | All |
| Application | Oracle | Graalvm | 21.2.0 | All | All | All |
| Application | Siemens | Sinec Infrastructure Network Services | All | All | All | All |
References
| Reference | Source | Link | Tags |
|---|---|---|---|
| Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning using symbolic links · Advisory · npm/node-tar · GitHub | CONFIRM | github.com | |
| [SECURITY] [DLA 3237-1] node-tar security update | MLIST | lists.debian.org | |
| Debian -- Security Information -- DSA-5008-1 node-tar | DEBIAN | www.debian.org | |
| Oracle Critical Patch Update Advisory - October 2021 | MISC | www.oracle.com | |
| cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf | CONFIRM | cert-portal.siemens.com | |
| tar - npm | MISC | www.npmjs.com | |
| CVE Program record | CVE.ORG | www.cve.org | canonical |
| NVD vulnerability detail | NVD | nvd.nist.gov | canonical, analysis |
No vendor comments have been submitted for this CVE.
Legacy QID Mappings
- 159622 Oracle Enterprise Linux Security Update for nodejs:14 (ELSA-2022-0350)
- 178894 Debian Security Update for node-tar (DSA 5008-1)
- 181317 Debian Security Update for node-tar (DLA 3237-1)
- 182562 Debian Security Update for node-tar (CVE-2021-37701)
- 239986 Red Hat Update for rh-nodejs14-nodejs and rh-nodejs14-nodejs-nodemon (RHSA-2022:0041)
- 240037 Red Hat Update for nodejs:14 security (RHSA-2022:0246)
- 240051 Red Hat Update for nodejs:14 security (RHSA-2022:0350)
- 240414 Red Hat Update for rh-nodejs12-nodejs security (RHSA-2022:4914)
- 296065 Oracle Solaris 11.4 Support Repository Update (SRU) 39.107.1 Missing (CPUOCT2021)
- 375828 Node.js Multiple Vulnerabilities (August 2021)
- 377422 Alibaba Cloud Linux Security Update for nodejs:14 (ALINUX3-SA-2022:0014)
- 500445 Alpine Linux Security Update for nodejs
- 501454 Alpine Linux Security Update for nodejs
- 504208 Alpine Linux Security Update for nodejs
- 690030 Free Berkeley Software Distribution (FreeBSD) Security Update for node.js (7062bce0-1b17-11ec-9d9d-0022489ad614)
- 751457 OpenSUSE Security Update for nodejs12 (openSUSE-SU-2021:3940-1)
- 751475 OpenSUSE Security Update for nodejs14 (openSUSE-SU-2021:3964-1)
- 751509 OpenSUSE Security Update for nodejs12 (openSUSE-SU-2021:1574-1)
- 751518 OpenSUSE Security Update for nodejs14 (openSUSE-SU-2021:1552-1)
- 940448 AlmaLinux Security Update for nodejs:14 (ALSA-2022:0350)
- 960863 Rocky Linux Security Update for nodejs:14 (RLSA-2022:0350)
- 980150 Nodejs (npm) Security Update for tar (GHSA-9r2w-394v-53qc)