CVE-2021-32804Arbitrary File Creation/Overwrite due to insufficient absolute path sanitization
The npm package "tar" (aka node-tar) before versions 6.1.1, 5.0.6, 4.4.14, and 3.3.2 has a arbitrary File Creation/Overwrite vulnerability 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 `/home/user/.bashrc` would turn into `home/user/.bashrc`. This logic was insufficient when file paths contained repeated path roots such as `////home/user/.bashrc`. `node-tar` would only strip 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`) would still resolve to an absolute path, thus allowing arbitrary file creation and overwrite. This issue was addressed in releases 3.2.2, 4.4.14, 5.0.6 and 6.1.1. Users may work around this vulnerability without upgrading by creating a custom `onentry` method which sanitizes the `entry.path` or a `filter` method which removes entries with absolute paths. See referenced GitHub Advisory for details. Be aware of CVE-2021-32803 which fixes a similar bug in later versions of tar.
What to do
Likely to be exploited: EPSS gives a 15% chance of exploitation in the next 30 days. Treat it as urgent if you run an affected version.
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
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.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.10 | node-tar | Fix pending | UBUNTU-CVE-2021-32804 | |
| Ubuntu 26.04 | node-tar | Under investigation | UBUNTU-CVE-2021-32804 | |
| Ubuntu 25.10 | node-tar | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2021-32804 | |
| Ubuntu 24.04 | node-tar | Under investigation | UBUNTU-CVE-2021-32804 | |
| Ubuntu 22.04 | node-tar | Under investigation | UBUNTU-CVE-2021-32804 | |
| Ubuntu 20.04 | node-tar | Fix pending | UBUNTU-CVE-2021-32804 | |
| Ubuntu 18.04 | node-tar | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2021-32804 | |
| Ubuntu 16.04 | node-tar | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2021-32804 | |
| Ubuntu 14.04 | node-tar | Fix pending | UBUNTU-CVE-2021-32804 | |
| Debian 14 | node-tar | Fixed | 6.1.7+~cs11.3.10-1 | DEBIAN-CVE-2021-32804 |
| Debian 13 | node-tar | Fixed | 6.1.7+~cs11.3.10-1 | DEBIAN-CVE-2021-32804 |
| Debian 12 | node-tar | Fixed | 6.1.7+~cs11.3.10-1 | DEBIAN-CVE-2021-32804 |
| Red Hat Enterprise Linux 9 | nodejs | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs-docs | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs-full-i18n | Not affected | ||
| Red Hat Enterprise Linux 9 | nodejs-libs | Not affected | ||
| Red Hat Enterprise Linux 9 | npm | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs | Fixed | 1:14.17.5-1.module+el8.4.0+12247+e2879e58 | RHSA-2021:3623 |
| Red Hat Enterprise Linux 8 | nodejs-devel | Fixed | 1:14.17.5-1.module+el8.4.0+12247+e2879e58 | RHSA-2021:3623 |
| Red Hat Enterprise Linux 8 | nodejs-docs | Fixed | 1:12.22.5-1.module+el8.4.0+12242+af52a4c7 | RHSA-2021:3666 |
| Red Hat Enterprise Linux 8 | nodejs-full-i18n | Fixed | 1:12.22.5-1.module+el8.4.0+12242+af52a4c7 | RHSA-2021:3666 |
| Red Hat Enterprise Linux 8 | nodejs-libs | Not affected | ||
| Red Hat Enterprise Linux 8 | nodejs-nodemon | Fixed | 0:2.0.3-1.module+el8.4.0+11732+c668cc9f | RHSA-2021:3666 |
| Red Hat Enterprise Linux 8 | nodejs-packaging | Fixed | 0:17-3.module+el8.1.0+3369+37ae6a45 | RHSA-2021:3666 |
| Red Hat Enterprise Linux 8 | nodejs-packaging-bundler | Not affected | ||
| Red Hat Enterprise Linux 8 | npm | Fixed | 1:6.14.14-1.12.22.5.1.module+el8.4.0+12242+af52a4c7 | RHSA-2021:3666 |
| Red Hat Enterprise Linux 8 | v8-12.4-devel | Not affected | ||
| Red Hat Enterprise Linux 8 | v8-13.6-devel | Not affected | ||
| AlmaLinux 8 | nodejs | Fixed | 1:12.22.5-1.module_el8.5.0+85+79a7b441 | ALSA-2021:3623 |
| AlmaLinux 8 | nodejs-devel | Fixed | 1:12.22.5-1.module_el8.5.0+85+79a7b441 | ALSA-2021:3623 |
| AlmaLinux 8 | nodejs-docs | Fixed | 1:12.22.5-1.module_el8.4.0+2529+af52a4c7 | ALSA-2021:3623 |
| AlmaLinux 8 | nodejs-full-i18n | Fixed | 1:12.22.5-1.module_el8.5.0+85+79a7b441 | ALSA-2021:3623 |
| AlmaLinux 8 | nodejs-nodemon | Fixed | 2.0.3-1.module_el8.4.0+2521+c668cc9f | ALSA-2021:3666 |
| AlmaLinux 8 | nodejs-packaging | Fixed | 17-3.module_el8.3.0+2023+d2377ea3 | ALSA-2021:3623 |
| AlmaLinux 8 | npm | Fixed | 1:6.14.14-1.12.22.5.1.module_el8.5.0+85+79a7b441 | ALSA-2021:3623 |
| Rocky Linux 8 | nodejs | Fixed | 1:12.22.5-1.module+el8.4.0+647+e905fa21 | RLSA-2021:3666 |
| Rocky Linux 8 | nodejs-nodemon | Fixed | 0:2.0.3-1.module+el8.6.0+982+9fdca2d4 | RLSA-2021:3623 |
| Rocky Linux 8 | nodejs-packaging | Fixed | 0:23-3.module+el8.3.0+100+234774f7 | RLSA-2021:3666 |
| npm library | tar | Fixed | 3.2.2 | GHSA-3jfq-g458-7qm9 |
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.
- npm node-tar: affected: < 3.2.2, >= 4.0.0, < 4.4.14, >= 5.0.0, < 5.0.6, >= 6.0.0, < 6.1.1
References
- https://www.npmjs.com/package/tar
- https://github.com/npm/node-tar/security/advisories/GHSA-3jfq-g458-7qm9
- https://github.com/npm/node-tar/commit/1f036ca23f64a547bdd6c79c1a44bc62e8115da4
- https://www.npmjs.com/advisories/1770
- https://www.oracle.com/security-alerts/cpuoct2021.html
- https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf
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.