CVEfocus › CVE database › CVE-2021-32803

CVE-2021-32803Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory…

CVSS 8.2 HighEPSS 7.1% (higher than 95% of CVEs)Published 2021-08-03Updated 2024-08-03Assigner: GitHub_M

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.

CWE-22

What to do

Fixed builds are available from AlmaLinux, Debian, Red Hat, Rocky Linux, npm: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

21Fixed
3Fix pending
14Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.04node-tarNot affected
vulnerable_code_not_present
Ubuntu 25.10node-tarNot affected
vulnerable_code_not_present
Ubuntu 24.04node-tarNot affected
vulnerable_code_not_present
Ubuntu 22.04node-tarNot affected
vulnerable_code_not_present
Ubuntu 20.04node-tarFix pending4.4.10+ds1-2ubuntu1+esm1 (Ubuntu Pro)UBUNTU-CVE-2021-32803
Ubuntu 18.04node-tarNot affected
vulnerable_code_not_present
Ubuntu 16.04node-tarFix pending
Ubuntu 14.04node-tarFix pendingUBUNTU-CVE-2021-32803
Debian 14node-tarFixed6.1.7+~cs11.3.10-1DEBIAN-CVE-2021-32803
Debian 13node-tarFixed6.1.7+~cs11.3.10-1DEBIAN-CVE-2021-32803
Debian 12node-tarFixed6.1.7+~cs11.3.10-1DEBIAN-CVE-2021-32803
Red Hat Enterprise Linux 9nodejsNot affected
Red Hat Enterprise Linux 9nodejs-docsNot affected
Red Hat Enterprise Linux 9nodejs-full-i18nNot affected
Red Hat Enterprise Linux 9nodejs-libsNot affected
Red Hat Enterprise Linux 9npmNot affected
Red Hat Enterprise Linux 8nodejsFixed1:14.17.5-1.module+el8.4.0+12247+e2879e58RHSA-2021:3623
Red Hat Enterprise Linux 8nodejs-develFixed1:12.22.5-1.module+el8.4.0+12242+af52a4c7RHSA-2021:3666
Red Hat Enterprise Linux 8nodejs-docsFixed1:12.22.5-1.module+el8.4.0+12242+af52a4c7RHSA-2021:3666
Red Hat Enterprise Linux 8nodejs-full-i18nFixed1:12.22.5-1.module+el8.4.0+12242+af52a4c7RHSA-2021:3666
Red Hat Enterprise Linux 8nodejs-libsNot affected
Red Hat Enterprise Linux 8nodejs-nodemonFixed0:2.0.3-1.module+el8.3.0+6519+9f98ed83RHSA-2021:3623
Red Hat Enterprise Linux 8nodejs-packagingFixed0:23-3.module+el8.3.0+6519+9f98ed83RHSA-2021:3623
Red Hat Enterprise Linux 8nodejs-packaging-bundlerNot affected
Red Hat Enterprise Linux 8npmFixed1:6.14.14-1.14.17.5.1.module+el8.4.0+12247+e2879e58RHSA-2021:3623
Red Hat Enterprise Linux 8v8-12.4-develNot affected
Red Hat Enterprise Linux 8v8-13.6-develNot affected
AlmaLinux 8nodejsFixed1:12.22.5-1.module_el8.5.0+85+79a7b441ALSA-2021:3623
AlmaLinux 8nodejs-develFixed1:12.22.5-1.module_el8.5.0+85+79a7b441ALSA-2021:3623
AlmaLinux 8nodejs-docsFixed1:12.22.5-1.module_el8.4.0+2529+af52a4c7ALSA-2021:3623
AlmaLinux 8nodejs-full-i18nFixed1:12.22.5-1.module_el8.5.0+85+79a7b441ALSA-2021:3623
AlmaLinux 8nodejs-nodemonFixed2.0.3-1.module_el8.4.0+2521+c668cc9fALSA-2021:3666
AlmaLinux 8nodejs-packagingFixed17-3.module_el8.3.0+2023+d2377ea3ALSA-2021:3623
AlmaLinux 8npmFixed1:6.14.14-1.12.22.5.1.module_el8.5.0+85+79a7b441ALSA-2021:3623
Rocky Linux 8nodejsFixed1:12.22.5-1.module+el8.4.0+647+e905fa21RLSA-2021:3666
Rocky Linux 8nodejs-nodemonFixed0:2.0.3-1.module+el8.3.0+100+234774f7RLSA-2021:3666
Rocky Linux 8nodejs-packagingFixed0:23-3.module+el8.3.0+100+234774f7RLSA-2021:3666
npm librarytarFixed3.2.3GHSA-r628-mhmh-qjhw

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.