Arbitrary File Overwrite Affecting tar package, versions <3.2.2>=4.0.0 <4.4.14>=5.0.0 <5.0.6>=6.0.0 <6.1.1


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.69% (81st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Arbitrary File Overwrite vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-TAR-1536531
  • published4 Aug 2021
  • disclosed4 Aug 2021
  • creditginkoid, chen-robert

Introduced: 4 Aug 2021

CVE-2021-32804  (opens in a new tab)
CWE-22  (opens in a new tab)

How to fix?

Upgrade tar to version 3.2.2, 4.4.14, 5.0.6, 6.1.1 or higher.

Overview

tar is a full-featured Tar for Node.js.

Affected versions of this package are vulnerable to Arbitrary File Overwrite. This is due to insufficient absolute path sanitization.

node-tar aims to prevent extraction of absolute file paths by turning absolute paths into relative paths when the preservePaths flag is not set to true. This is achieved by stripping the absolute path root from any absolute file paths contained in a tar file. For example, the path /home/user/.bashrc would turn into home/user/.bashrc.

This logic is insufficient when file paths contain repeated path roots such as ////home/user/.bashrc. node-tar only strips a single path root from such paths. When given an absolute file path with repeating path roots, the resulting path (e.g. ///home/user/.bashrc) still resolves to an absolute path.

References

CVSS Scores

version 3.1