CVE-2021-32803
Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning
Also known as GHSA-r628-mhmh-qjhw
Mitigation
- Upgrade tar to one of 3.2.3, 4.4.15, 5.0.7, 6.1.2 (or later in the same release line).
Who should check
- Projects that depend on npm package tar (>= 3.0.0, < 3.2.3)
- Anyone running npm node-tar < 3.2.3; >= 4.0.0, < 4.4.15; >= 5.0.0, < 5.0.7; >= 6.0.0, < 6.1.2
Vulnerability facts
- Affected
- tar >= 3.0.0, < 3.2.3
- Fixed in
- 3.2.3, 4.4.15, 5.0.7, 6.1.2
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 8.2 (v3.1, CNA)CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Local
- Attack complexity: Low
- Privileges required: None
- User interaction: Required
- Scope: Changed (impact reaches other components)
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: None
- EPSS
- 7.10% chance of exploitation in 30 days (percentile 95, 2026-11-26)
- CWE
- CWE-22
- Modified
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 and fixed versions
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2021-32803. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2021-32803.md Affected: tar >= 3.0.0, < 3.2.3 Fixed in: 3.2.3, 4.4.15, 5.0.7, 6.1.2 Steps: 1. Search this machine and project for tar (npm), npm node-tar: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Patches
- https://github.com/npm/node-tar/commit/9dbdeb6df8e9dbd96fa9e84341b9d74734be6c20
- https://www.oracle.com/security-alerts/cpuoct2021.html
- https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf
- https://github.com/isaacs/node-tar/commit/46fe35083e2676e31c4e0a81639dce6da7aaa356
- https://github.com/isaacs/node-tar/commit/5987d9a41f6bfbf1ddab1098e1fdcf1a5618f571
- https://github.com/isaacs/node-tar/commit/85d3a942b4064e4ff171f91696fced7975167349
- https://github.com/isaacs/node-tar/commit/9dbdeb6df8e9dbd96fa9e84341b9d74734be6c20
FAQ
Is CVE-2021-32803 being exploited?
There is no confirmed exploitation: CVE-2021-32803 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 7.10% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2021-32803?
High: CVSS 8.2 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work.
Which versions are affected by CVE-2021-32803?
tar >= 3.0.0, < 3.2.3.
Is there a fix for CVE-2021-32803?
Yes. Fixed in 3.2.3, 4.4.15, 5.0.7, 6.1.2. Upgrade tar to one of 3.2.3, 4.4.15, 5.0.7, 6.1.2 (or later in the same release line).
How do I check if I'm affected by CVE-2021-32803?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.