PT-2021-7037 · Npm+6 · Node-Tar+6

Published

2021-08-31

·

Updated

2023-02-23

·

CVE-2021-37712

CVSS v3.1

8.6

High

VectorAV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
Name of the Vulnerable Software and Affected Versions node-tar versions prior to 4.4.18 node-tar versions prior to 5.0.10 node-tar versions prior to 6.1.9
Description The issue is related to the handling of tar archives by the node-tar module, which can lead to arbitrary file creation, overwrite, and code execution. This is due to insufficient logic when extracting tar files containing directories and symlinks with names that have the same unicode normalization. On Windows systems, long path portions can resolve to the same file system entities as their 8.3 "short path" counterparts, allowing an untrusted tar file to symlink into an arbitrary location and extract arbitrary files.
Recommendations For node-tar versions prior to 4.4.18, update to version 4.4.18 or later. For node-tar versions prior to 5.0.10, update to version 5.0.10 or later. For node-tar versions prior to 6.1.9, update to version 6.1.9 or later. As a temporary workaround, users can create 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
  }
 }
})

Exploit

Fix

Link Following

Path traversal

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

Weakness Enumeration

Related Identifiers

ALSA-2022:0350
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-03022
CESA-2022_0350
CVE-2021-37712
DLA-3237-1
DSA-5008-1
GHSA-QQ89-HQ3F-393P
MGASA-2021-0463
MGASA-2022-0103
OPENSUSE-SU-2021:1552-1
OPENSUSE-SU-2021:1574-1
OPENSUSE-SU-2021:3940-1
OPENSUSE-SU-2021:3964-1
OPENSUSE-SU-2021_1552-1
OPENSUSE-SU-2021_1574-1
OPENSUSE-SU-2021_3940-1
OPENSUSE-SU-2021_3964-1
RHSA-2022:0041
RHSA-2022:0246
RHSA-2022:0350
RHSA-2022:4914
RHSA-2022_0350
RLSA-2022:0350
SUSE-SU-2021:3886-1
SUSE-SU-2021:3940-1
SUSE-SU-2021:3964-1
SUSE-SU-2022:0101-1

Affected Products

Alt Linux
Almalinux
Centos
Red Hat
Rocky Linux
Suse
Node-Tar