CVE-2021-32804: node-tar - Path Traversal
- Cve: CVE-2021-32804
- Name: node-tar - Path Traversal
- Description: 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.
- Impact: Attackers can overwrite or create arbitrary files on the system during extraction, potentially leading to code execution or system compromise.
- Remediation: Update to version 3.2.2, 4.4.14, 5.0.6, or 6.1.1 or later. Alternatively, sanitize 'entry.path' or filter entries with absolute paths during extraction.
- Vulnerability type: path_traversal
- Vulnerability impact: file_system_write
- Requirement type: none
- Labels source: projectdiscovery
- Severity: high
- Cvss score: 8.1
- Cvss vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H
- Epss score: 0.15067
- Epss percentile: 0.96812
- Assignee: [email protected]
- Published at: 2021-08-03T19:15:08Z
- Age in days: 1939
- Modified at: 2026-06-17T03:53:39Z
- Patch available: yes
- Public exploits total: 2
- References total: 6
- Products total: 3
- Oss: yes
- Projects total: 1
- Advisory url: https://nvd.nist.gov/vuln/detail/CVE-2021-32804
- Nvd status: modified
- Checked, none or zero: known exploited entries, nuclei templates, public exploits capped, rejected by nvd
- Not known: requirements, hackerone
Cwe
| Id | Name |
|---|---|
| CWE-22 | Improper Limitation of a Pathname to a Restricted Directory |
Public exploits
| Url | Source | Added date |
|---|---|---|
| https://github.com/federiconbaez/cortex9-node-tar-path-sanitization-model | poc-in-github | 2026-11-06 |
| https://github.com/yamory/CVE-2021-32804 | poc-in-github | 2021-08-31 |
References
Same in every row:
- Source: nvd
| Url | Tags |
|---|---|
| https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf | Patch, Third Party Advisory |
| https://github.com/npm/node-tar/commit/1f036ca23f64a547bdd6c79c1a44bc62e8115da4 | Patch, Third Party Advisory |
| https://www.oracle.com/security-alerts/cpuoct2021.html | Patch, Third Party Advisory |
| https://github.com/npm/node-tar/security/advisories/GHSA-3jfq-g458-7qm9 | Mitigation, Third Party Advisory |
| https://www.npmjs.com/advisories/1770 | Mitigation, Third Party Advisory |
| https://www.npmjs.com/package/tar | Product, Third Party Advisory |
Products
Same in every row:
- Platform bound: no
- Sources: nvd
| Product | Affected | Url |
|---|---|---|
| tar_project:tar | >= 6.0.0, < 6.1.1; >= 5.0.0, < 5.0.6; >= 4.0.0, < 4.4.14; < 3.2.2 | /v1/products/tar_project/tar |
| oracle:graalvm | = 21.2.0, = 20.3.3 | /v1/products/oracle/graalvm |
| siemens:sinec_infrastructure_network_services | < 1.0.1.1 | /v1/products/siemens/sinec_infrastructure_network_services |
Projects
| Repository | Link kinds | Indexed | Url |
|---|---|---|---|
| npm/node-tar | commit, package, security_advisory | yes | /v1/repositories/npm/node-tar |
Index
- Repositories: 352
- Repositories high signal: 60
- Packages: 1
Exploitation
- Public exploit: yes
- Public exploit count: 2
- Public exploit first date: 2021-08-31
- Remote: yes
- Checked, none or zero: known exploited, known exploited by, exploitation seen, initial access, authentication required
- Not known: known exploited since, vulncheck known exploited since, nuclei template, initial access since, hackerone reports, exposed hosts