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

  • Attack Complexity


  • User Interaction


  • Scope


  • Confidentiality


  • Integrity


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-id


  • published

    4 Aug 2021

  • disclosed

    4 Aug 2021

  • credit

    ginkoid, chen-robert

How to fix?

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


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.