Quick answers
- Is CVE-2021-32803 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2021-32803 being exploited in the wild.
- How severe is CVE-2021-32803?
- Low severity, with a CVSS score of 3.1, published 3 August 2021.
- Which products and versions are affected?
- tar (npm) SEMVER:introduced=3.0.0,fixed=3.2.3.
- Is there a fix for CVE-2021-32803?
- Yes. tar (npm): upgrade to 3.2.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2021-32803 attacked?
- It is attacked with local access.
- Am I affected by CVE-2021-32803?
- Check whether you run tar (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- tar (npm): upgrade to 3.2.3 or later
npm install tar@3.2.3
Technical details
The vulnerability is a directory cache poisoning flaw in npm tar's symlink protection logic. The library maintains a cache of created directories to optimize performance and prevent symlink attacks. However, when a tar archive contains both a directory and a symlink with the same name, the directory is cached first. Subsequent mkdir calls for that path are then skipped, and critically, the symlink validation that normally occurs during mkdir is also bypassed. An attacker can exploit this by crafting a tar file that creates a directory, then replaces it with a symlink pointing to an arbitrary location, enabling arbitrary file creation and overwrite. The vulnerability affects npm tar versions 3.0.0–3.2.2, 4.0.0–4.4.14, 5.0.0–5.0.6, and 6.0.0–6.1.1, and is fixed in versions 3.2.3, 4.4.15, 5.0.7, and 6.1.2.
Affected products
- npm tar <3.2.3 || 4.x <4.4.15 || 5.x <5.0.7 || 6.x <6.1.2
Identifiers
- CVE-2021-32803
- GHSA-r628-mhmh-qjhw
Timeline
- 2021-08-03: disclosed
- 2021-08-03: patched: Fixed in versions 3.2.3, 4.4.15, 5.0.7, and 6.1.2