PT-2021-5776 · Npm+9 · Node-Tar+9

Published

2021-07-27

·

Updated

2022-11-14

·

CVE-2021-32803

CVSS v3.1

9.8

Critical

VectorAV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Name of the Vulnerable Software and Affected Versions node-tar versions prior to 3.2.3 node-tar versions prior to 4.4.15 node-tar versions prior to 5.0.7 node-tar versions prior to 6.1.2
Description The issue is related to insufficient symlink protection in the node-tar module for handling tar archives. This allows an attacker to bypass symlink checks on directories, enabling arbitrary file creation and overwrite. The vulnerability can be exploited by creating a directory and then replacing it with a symlink, thus allowing an untrusted tar file to extract arbitrary files into an arbitrary location.
Recommendations For versions prior to 3.2.3, update to version 3.2.3 or later. For versions prior to 4.4.15, update to version 4.4.15 or later. For versions prior to 5.0.7, update to version 5.0.7 or later. For versions prior to 6.1.2, update to version 6.1.2 or later. As a temporary workaround, consider creating a custom filter method to prevent the extraction of symbolic links, such as:
js
const tar = require('tar')
tar.x({
 file: 'archive.tgz',
 filter: (file, entry) => {
  if (entry.type === 'SymbolicLink') {
   return false
  } else {
   return true
  }
 }
})

Fix

Path traversal

Relative Path Traversal

Link Following

Found an issue in the description? Have something to add? Feel free to write us 👾

Weakness Enumeration

Related Identifiers

ALSA-2021:3623
ALSA-2021:3666
ALT-PU-2021-2920
ALT-PU-2021-2921
ALT-PU-2021-3615
ALT-PU-2022-1798
ALT-PU-2022-3069
ALT-PU-2022-3073
BDU:2022-00226
CESA-2021_3623
CESA-2021_3666
CVE-2021-32803
GHSA-R628-MHMH-QJHW
MGASA-2022-0103
OPENSUSE-SU-2022:0657-1
OPENSUSE-SU-2022:0704-1
OPENSUSE-SU-2022:0715-1
OPENSUSE-SU-2022_0657-1
OPENSUSE-SU-2022_0704-1
OPENSUSE-SU-2022_0715-1
OPENSUSE-SU-2022_1717-1
RHSA-2021:3280
RHSA-2021:3281
RHSA-2021:3623
RHSA-2021:3638
RHSA-2021:3639
RHSA-2021:3666
RHSA-2021_3623
RHSA-2021_3666
RLSA-2021:3623
RLSA-2021:3666
SUSE-SU-2022:0531-1
SUSE-SU-2022:0563-1
SUSE-SU-2022:0569-1
SUSE-SU-2022:0570-1
SUSE-SU-2022:0657-1
SUSE-SU-2022:0704-1
SUSE-SU-2022:0715-1
SUSE-SU-2022:1717-1
SUSE-SU-2022_1717-1
USN-5283-1

Affected Products

Alt Linux
Almalinux
Astra Linux
Centos
Linuxmint
Red Hat
Rocky Linux
Suse
Ubuntu
Node-Tar