CVE-2021-37701
Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning using symbolic links
Also known as GHSA-9r2w-394v-53qc
Mitigation
- Upgrade tar to one of 4.4.16, 5.0.8, 6.1.7 (or later in the same release line).
Who should check
- Projects that depend on npm package tar (>= 3.0.0, < 4.4.16)
- Anyone running npm node-tar < 4.4.16; >= 5.0.0, < 5.0.8; >= 6.0.0, < 6.1.7
Vulnerability facts
- Affected
- tar >= 3.0.0, < 4.4.16
- Fixed in
- 4.4.16, 5.0.8, 6.1.7
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 8.2 (v3.1, CNA)CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Local
- Attack complexity: Low
- Privileges required: None
- User interaction: Required
- Scope: Changed (impact reaches other components)
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: None
- EPSS
- 1.84% chance of exploitation in 30 days (percentile 80, 2026-11-26)
- CWE
- CWE-22, CWE-59
- Modified
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.
Affected and fixed versions
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2021-37701. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2021-37701.md Affected: tar >= 3.0.0, < 4.4.16 Fixed in: 4.4.16, 5.0.8, 6.1.7 Steps: 1. Search this machine and project for tar (npm), npm node-tar: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Patches
FAQ
Is CVE-2021-37701 being exploited?
There is no confirmed exploitation: CVE-2021-37701 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.84% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2021-37701?
High: CVSS 8.2 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work.
Which versions are affected by CVE-2021-37701?
tar >= 3.0.0, < 4.4.16.
Is there a fix for CVE-2021-37701?
Yes. Fixed in 4.4.16, 5.0.8, 6.1.7. Upgrade tar to one of 4.4.16, 5.0.8, 6.1.7 (or later in the same release line).
How do I check if I'm affected by CVE-2021-37701?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.