CVE-2021-37713: Arbitrary File Creation/Overwrite on Windows via insufficient relative path sanitization in tar

tar Updated 02 Oct 2025

Summary

31/08/2021
Yes i
High
8.2

CVE-2021-37713: Arbitrary File Creation/Overwrite on Windows via insufficient relative path sanitization. Affects tar across 3 version ranges.

< 4.4.18 >= 5.0.0, < 5.0.10 >= 6.0.0, < 6.1.9

Fixed in 4.4.18, 5.0.10 or 6.1.9, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-37713 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The 'tar' package is an open-source library for creating and extracting tar archives in the Node.js ecosystem. It provides functionality to compress and decompress files and directories. However, a vulnerability has been identified in versions prior to 4.4.18, 5.0.10, and 6.1.9 that allows arbitrary file creation, overwrite, and potential code execution on Windows systems. This vulnerability arises from insufficient relative path sanitization during the extraction process.

Vulnerability Detail

The vulnerability in the 'tar' package affects Windows systems when extracting tar files that contain a path with a different drive letter than the extraction target. For example, if the extraction target is 'D:\extraction\dir' and the tar file contains a path like 'C:some\path', the path resolution would occur against the current working directory on the 'C:' drive instead of the extraction target directory. Additionally, paths starting with a drive letter followed by two dots, such as 'c:..', bypass the check for '..' path portions. This allows an attacker to create or overwrite arbitrary files outside the intended extraction target directory, potentially leading to arbitrary code execution.

How To Fix

Latest published version: 7.5.22 as of 22 Oct 2026

npm install tar@7.5.22

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 4.4.18 4.4.18
    npm install tar@4.4.18
  • >= 5.0.0, < 5.0.10 5.0.10
    npm install tar@5.0.10
  • >= 6.0.0, < 6.1.9 6.1.9
    npm install tar@6.1.9

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

There is no reasonable workaround for this issue without performing the same path normalization procedures implemented in the patched versions of 'tar'. It is strongly advised to upgrade to the latest patched versions rather than attempting to sanitize paths manually.

Conclusion

The 'tar' package prior to versions 4.4.18, 5.0.10, and 6.1.9 is vulnerable to arbitrary file creation, overwrite, and potential code execution on Windows systems. Upgrading to the latest patched versions is crucial to mitigate this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tar →

Share this vulnerability

FAQ

The impact of this vulnerability includes arbitrary file creation, arbitrary file overwrite, and potential arbitrary code execution on Windows systems using the 'tar' package prior to versions 4.4.18, 5.0.10, and 6.1.9.

No, this vulnerability only affects Windows systems.

There are no reasonable workarounds for this vulnerability. Upgrading to the latest patched versions of the 'tar' package is the recommended solution.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities without requiring access to the code or installation.

The CVSS score for this vulnerability is 8.2, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for tar.

How To Fix

Latest published version: 7.5.22 as of 22 Oct 2026

npm install tar@7.5.22

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 4.4.18 4.4.18
    npm install tar@4.4.18
  • >= 5.0.0, < 5.0.10 5.0.10
    npm install tar@5.0.10
  • >= 6.0.0, < 6.1.9 6.1.9
    npm install tar@6.1.9

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback