Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦
📦 npm
Not in CISA KEV
HIGH severity

CVE-2021-37712 — tar

HIGHFix: isaacs/node-tar@1739408

CVE-2021-37712 is a high-severity (CVSS 8.6) Path Traversal vulnerability in tar. A fix is available for tar — see the affected versions and patch details below.

Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning using symbolic links

Also known asGHSA-qq89-hq3f-393p
Published
Updated
Affected
3 pkgs
Patched
3 / 3
Exploits
None indexed
Exploitation data as of Oct 10, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

EPSS Exploitation Probability

via FIRST.org ↗
1.9%probability of exploitation in next 30 days
Lower Risk+0.02%
Lower risk than most CVEs79th percentile — riskier than 79% of all scored CVEsHighest risk
0.00%0.80%1.60%2.40%0.1%1.8%1.8%1.9%Jun 26Aug 26Oct 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

CVE-2021-37712 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.

Where this sits among everything scored

Of 385,987 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.

Real-World Exposure

3 pkgs affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.

8Kother npm packages depend on this — each one inherits the vulnerability until it's patched upstream
tarnpm
88.9Mdownloads / week

Description

Impact

Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution

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 two directories 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 directories with two forms of the path that resolve to the same file system entity, followed by a symbolic link with a name in the first form, lastly followed by a file using the second form. It led to bypassing 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.

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 below.

Patches

6.1.9 || 5.0.10 || 4.4.18

Workarounds

Users may work around this vulnerability without upgrading by creating a custom filter method which prevents the extraction of symbolic links.

const tar = require('tar')

tar.x({
  file: 'archive.tgz',
  filter: (file, entry) => {
    if (entry.type === 'SymbolicLink') {
      return false
    } else {
      return true
    }
  }
})

Users are encouraged to upgrade to the latest patched versions, rather than attempt to sanitize tar input themselves.

Fix

The problem is addressed in the following ways, when comparing paths in the directory cache and path reservation systems:

  1. The String.normalize('NFKD') method is used to first normalize all unicode to its maximally compatible and multi-code-point form.
  2. All slashes are normalized to / on Windows systems (on posix systems, \ is a valid filename character, and thus left intact).
  3. When a symbolic link is encountered on Windows systems, the entire directory cache is cleared. Collisions related to use of 8.3 short names to replace directories with other (non-symlink) types of entries may make archives fail to extract properly, but will not result in arbitrary file writes.

Affected Packages

3 total 3 fixed
EcosystemPackageVulnerable rangeFix
📦npmtar≥ 3.0.0&&< 4.4.184.4.18npm install tar@4.4.18
📦npmtar≥ 5.0.0&&< 5.0.105.0.10npm install tar@5.0.10
📦npmtar≥ 6.0.0&&< 6.1.96.1.9npm install tar@6.1.9

Affected Products

4 products · 8 configurations
OS
debian linuxdebian
2 versions
10.011.0
Application
tarnpmjs
≥ 6.0.0 && ≤ 6.1.8
range
Application
graalvmoracle
2 versions
20.3.321.2.0
Application
sinec infrastructure network servicessiemens
< 1.0.1.1
range

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for tar, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update tar to 4.4.18 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-37712 is resolved across your whole dependency graph.

  3. Workarounds

    Resolve every user-supplied path to its canonical form and reject anything that escapes the intended directory, and run the component under an account that has no read or write access outside the directory it legitimately serves.

Fixing This On Your OS

If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.

Red HatModerate

Red Hat Enterprise Linux version 8 and Red Hat Software Collection both embed `node-tar` in the npm command. However, npm explicitly prevents the extraction of symlink via a filter. npm might still be affected via node-gyp, if the attacker is able to control the target URL.

ProductFixed inAdvisory
Red Hat Enterprise Linux 8nodejs:12-8060020220523160029.ad008a3aRHEA-2022:5139
Red Hat Enterprise Linux 8nodejs:14-8050020211213115342.c5368500RHSA-2022:0350
Red Hat Enterprise Linux 8.1 Update Services for SAP Solutionsnodejs:12-8010020220518102644.c27ad7f8RHEA-2022:4925
Red Hat Enterprise Linux 8.2 Extended Update Supportnodejs:12-8020020220523154454.4cda2c84RHEA-2022:5221
Red Hat Enterprise Linux 8.4 Extended Update Supportnodejs:12-8040020220523155137.522a0ee4RHEA-2022:5615
Red Hat Enterprise Linux 8.4 Extended Update Supportnodejs:14-8040020211213111158.522a0ee4RHSA-2022:0246
Red Hat OpenShift Data Foundation 4.9.0 on RHEL-8odf4/cephcsi-rhel8:4.9-164.57484e3.release_4.9RHSA-2021:5086
Red Hat Software Collections for Red Hat Enterprise Linux 7rh-nodejs14-nodejs-0:14.18.2-1.el7RHSA-2022:0041

Frequently Asked Questions

### Impact Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution 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 two directories and a symlink with names containing unicode values that normalized to the sam
O3 Security · Impact-Aware SCA

Is CVE-2021-37712 in your dependencies?

Find it across npm, including transitive dependencies.

CVE-2021-37712: tar RCE — Fixed in 4.4.18