Skip to content
OpenAdvisories
High · 8.2 CVE-2021-32803 EUVD-2021-1856GHSA-r628-mhmh-qjhw

Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning

Published Aug 3, 2021 · Updated Aug 3, 2024 · Assigned by GitHub_M

Description

The npm package "tar" (aka node-tar) before versions 6.1.2, 5.0.7, 4.4.15, and 3.2.3 has an arbitrary File Creation/Overwrite vulnerability via insufficient symlink protection. `node-tar` aims to guarantee that any file whose location would be modified by a symbolic link is not extracted. This is, in part, achieved by ensuring that extracted directories are not symlinks. Additionally, in order to prevent unnecessary `stat` calls to determine whether a given path is a directory, paths are cached when directories are created. This logic was insufficient when extracting tar files that contained both a directory and a symlink with the same name as the directory. This order of operations resulted in the directory being created and added to the `node-tar` directory cache. When a directory is present in the directory cache, subsequent calls to mkdir for that directory are skipped. However, this is also where `node-tar` checks for symlinks occur. By first creating a directory, and then replacing that directory with a symlink, it was thus possible to bypass `node-tar` symlink checks on directories, essentially allowing an untrusted tar file to symlink into an arbitrary location and subsequently extracting arbitrary files into that location, thus allowing arbitrary file creation and overwrite. This issue was addressed in releases 3.2.3, 4.4.15, 5.0.7 and 6.1.2.

Affected products

VendorProductAffectedFixed
npm node-tar < 3.2.3, >= 4.0.0, < 4.4.15, >= 5.0.0, < 5.0.7, >= 6.0.0, < 6.1.2 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 node-tar 6.1.7+~cs11.3.10-1 —
Debian 13 node-tar 6.1.7+~cs11.3.10-1 —
Debian 12 node-tar 6.1.7+~cs11.3.10-1 —
ReleasePackageFixed inAdvisory
Ubuntu Pro 20.04 LTS node-tar 4.4.10+ds1-2ubuntu1+esm1 USN-5283-1
Ubuntu Pro 14.04 LTS node-tar No fix yet —
ReleasePackageFixed inAdvisory
RHEL 8 nodejs +3 1:12.22.5-1.module+el8.4.0+12242+af52a4c7 RHSA-2021:3666, RHSA-2021:3623
RHEL 8 nodejs-nodemon 2.0.3-1.module+el8.3.0+6519+9f98ed83 RHSA-2021:3666, RHSA-2021:3623
RHEL 8 nodejs-packaging 17-3.module+el8.1.0+3369+37ae6a45 RHSA-2021:3666, RHSA-2021:3623
RHEL 8 npm 1:6.14.14-1.12.22.5.1.module+el8.4.0+12242+af52a4c7 RHSA-2021:3666, RHSA-2021:3623
RHEL 3 rh-nodejs12-nodejs +2 12.22.5-1.el7 RHSA-2021:3281
RHEL 3 rh-nodejs12-nodejs-nodemon +1 2.0.3-5.el7 RHSA-2021:3281, RHSA-2021:3280
RHEL 3 rh-nodejs12-npm 6.14.14-12.22.5.1.el7 RHSA-2021:3281
RHEL 3 rh-nodejs14-nodejs +2 14.17.5-1.el7 RHSA-2021:3280
RHEL 3 rh-nodejs14-npm 6.14.14-14.17.5.1.el7 RHSA-2021:3280
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
RHEL 8.2 EUS nodejs +3 1:12.22.5-1.module+el8.2.0+12241+a3db445b RHSA-2021:3638
RHEL 8.2 EUS nodejs-nodemon 1.18.3-1.module+el8.1.0+3369+37ae6a45 RHSA-2021:3638
RHEL 8.2 EUS nodejs-packaging 17-3.module+el8.1.0+3369+37ae6a45 RHSA-2021:3638
RHEL 8.2 EUS npm 1:6.14.14-1.12.22.5.1.module+el8.2.0+12241+a3db445b RHSA-2021:3638
RHEL 8.1 EUS nodejs +3 1:12.22.5-1.module+el8.1.0+12238+63fe3aec RHSA-2021:3639
RHEL 8.1 EUS nodejs-nodemon 1.18.3-1.module+el8.1.0+3369+37ae6a45 RHSA-2021:3639
RHEL 8.1 EUS nodejs-packaging 17-3.module+el8.1.0+3369+37ae6a45 RHSA-2021:3639
RHEL 8.1 EUS npm 1:6.14.14-1.12.22.5.1.module+el8.1.0+12238+63fe3aec RHSA-2021:3639

AlmaLinux

Errata ↗
ReleasePackageFixed inAdvisory
AlmaLinux 8 nodejs +3 1:12.22.5-1.module_el8.4.0+2529+af52a4c7 ALSA-2021:3623
AlmaLinux 8 nodejs-nodemon 2.0.3-1.module_el8.4.0+2521+c668cc9f ALSA-2021:3666, ALSA-2021:3623
AlmaLinux 8 nodejs-packaging 17-3.module_el8.3.0+2023+d2377ea3 ALSA-2021:3666, ALSA-2021:3623
AlmaLinux 8 npm 1:6.14.14-1.12.22.5.1.module_el8.4.0+2529+af52a4c7 ALSA-2021:3623

Rocky Linux

Errata ↗
ReleasePackageFixed inAdvisory
Rocky Linux 8 nodejs 1:12.22.5-1.module+el8.4.0+647+e905fa21 RLSA-2021:3666, RLSA-2021:3623
Rocky Linux 8 nodejs-nodemon 2.0.3-1.module+el8.3.0+100+234774f7 RLSA-2021:3666, RLSA-2021:3623
Rocky Linux 8 nodejs-packaging 17-3.module+el8.3.0+101+f84c7154 RLSA-2021:3666, RLSA-2021:3623
ReleasePackageFixed inAdvisory
SLES 15 SP3 nodejs12 12.22.10-4.29.3 SUSE-SU-2022:0657-1
SLES 15 SP3 nodejs14 14.19.0-15.27.1 SUSE-SU-2022:0715-1
SLES 15 SP2 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SLES 15 SP2 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SLES 15 SP2 nodejs12 12.22.10-4.29.3 SUSE-SU-2022:0657-1
SLES 15 SP2 nodejs14 14.19.0-15.27.1 SUSE-SU-2022:0715-1
SLES 15 SP2 nodejs8 8.17.0-10.19.2 SUSE-SU-2022:0704-1
SLES 15 SP1 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SLES 15 SP1 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SLES 15 SP1 nodejs8 8.17.0-3.54.2 SUSE-SU-2022:0563-1
SLES 15 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SLES 15 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SLES 15 nodejs8 8.17.0-3.54.2 SUSE-SU-2022:0563-1
SLES 12 nodejs10 10.24.1-1.46.1 SUSE-SU-2022:0570-1
SLES 12 nodejs12 12.22.10-1.42.2 SUSE-SU-2022:0531-1
SLES 12 nodejs14 14.19.0-6.24.1 SUSE-SU-2022:0569-1
Show 11 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 15 SP2 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SLES for SAP 15 SP2 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SLES for SAP 15 SP2 nodejs12 12.22.10-4.29.3 SUSE-SU-2022:0657-1
SLES for SAP 15 SP2 nodejs14 14.19.0-15.27.1 SUSE-SU-2022:0715-1
SLES for SAP 15 SP2 nodejs8 8.17.0-10.19.2 SUSE-SU-2022:0704-1
SLES for SAP 15 SP1 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SLES for SAP 15 SP1 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SLES for SAP 15 SP1 nodejs8 8.17.0-3.54.2 SUSE-SU-2022:0563-1
SLES for SAP 15 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SLES for SAP 15 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SLES for SAP 15 nodejs8 8.17.0-3.54.2 SUSE-SU-2022:0563-1
SLE HPC 15 SP2 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SLE HPC 15 SP2 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SLE HPC 15 SP2 nodejs12 12.22.10-4.29.3 SUSE-SU-2022:0657-1
SLE HPC 15 SP2 nodejs14 14.19.0-15.27.1 SUSE-SU-2022:0715-1
SLE HPC 15 SP2 nodejs8 8.17.0-10.19.2 SUSE-SU-2022:0704-1
SLE HPC 15 SP1 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SLE HPC 15 SP1 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SLE HPC 15 SP1 nodejs8 8.17.0-3.54.2 SUSE-SU-2022:0563-1
SLE HPC 15 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SLE HPC 15 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SLE HPC 15 nodejs8 8.17.0-3.54.2 SUSE-SU-2022:0563-1
SUSE Manager Server 4.1 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SUSE Manager Server 4.1 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SUSE Manager Server 4.1 nodejs12 12.22.10-4.29.3 SUSE-SU-2022:0657-1
SUSE Manager Server 4.1 nodejs14 14.19.0-15.27.1 SUSE-SU-2022:0715-1
SUSE Manager Server 4.1 nodejs8 8.17.0-10.19.2 SUSE-SU-2022:0704-1
SUSE Manager Retail Branch Server 4.1 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SUSE Manager Retail Branch Server 4.1 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SUSE Manager Retail Branch Server 4.1 nodejs12 12.22.10-4.29.3 SUSE-SU-2022:0657-1
SUSE Manager Retail Branch Server 4.1 nodejs14 14.19.0-15.27.1 SUSE-SU-2022:0715-1
SUSE Manager Retail Branch Server 4.1 nodejs8 8.17.0-10.19.2 SUSE-SU-2022:0704-1
SUSE Manager Proxy 4.1 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SUSE Manager Proxy 4.1 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SUSE Manager Proxy 4.1 nodejs12 12.22.10-4.29.3 SUSE-SU-2022:0657-1
SUSE Manager Proxy 4.1 nodejs14 14.19.0-15.27.1 SUSE-SU-2022:0715-1
SUSE Manager Proxy 4.1 nodejs8 8.17.0-10.19.2 SUSE-SU-2022:0704-1
SUSE Enterprise Storage 7 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SUSE Enterprise Storage 7 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SUSE Enterprise Storage 7 nodejs12 12.22.10-4.29.3 SUSE-SU-2022:0657-1
SUSE Enterprise Storage 7 nodejs14 14.19.0-15.27.1 SUSE-SU-2022:0715-1
SUSE Enterprise Storage 7 nodejs8 8.17.0-10.19.2 SUSE-SU-2022:0704-1
SUSE Enterprise Storage 6 nodejs-common 2.0-3.4.1 SUSE-SU-2022:0704-1
SUSE Enterprise Storage 6 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
SUSE Enterprise Storage 6 nodejs8 8.17.0-3.54.2 SUSE-SU-2022:0563-1
ReleasePackageFixed inAdvisory
openSUSE Leap 15.4 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
openSUSE Leap 15.3 nodejs10 10.24.1-150000.1.44.1 SUSE-SU-2022:1717-1
openSUSE Leap 15.3 nodejs12 12.22.10-4.29.3 openSUSE-SU-2022:0657-1
openSUSE Leap 15.3 nodejs14 14.19.0-15.27.1 openSUSE-SU-2022:0715-1
openSUSE Leap 15.3 nodejs8 8.17.0-10.19.2 openSUSE-SU-2022:0704-1

Oracle Linux

ReleasePackageFixed inAdvisory
Oracle Linux 8 nodejs +3 1:12.22.5-1.module+el8.4.0+20308+065a70e3 ELSA-2021-3666, ELSA-2021-3623
Oracle Linux 8 nodejs-nodemon 2.0.3-1.module+el8.3.0+7818+6cd30d85 ELSA-2021-3666, ELSA-2021-3623
Oracle Linux 8 nodejs-packaging 17-3.module+el8.1.0+5393+aaf413e3 ELSA-2021-3666, ELSA-2021-3623
Oracle Linux 8 npm 1:6.14.14-1.12.22.5.1.module+el8.4.0+20308+065a70e3 ELSA-2021-3666, ELSA-2021-3623

Affected packages

EcosystemPackageAffectedFixedRecord
npm tar >= 3.0.0, < 3.2.3 3.2.3 GHSA-r628-mhmh-qjhw
npm tar >= 4.0.0, < 4.4.15 4.4.15 GHSA-r628-mhmh-qjhw
npm tar >= 5.0.0, < 5.0.7 5.0.7 GHSA-r628-mhmh-qjhw
npm tar >= 6.0.0, < 6.1.2 6.1.2 GHSA-r628-mhmh-qjhw

Advisories 33

References