Path Traversal in tar (CVE-2021-37701)
Summary
Path traversal in tar (CVE-2021-37701). Confidential information can be exposed externally. Exploitable via FOO. Mitigation: upgrade to 4.4.16 or later.
Original description
The description as published by the source.
Impact
Arbitrary File Creation, Arbitrary File Overwrite, Arbitrary Code Execution
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, where the symlink and directory names in the archive entry used backslashes as a path separator on posix systems. The cache checking logic used both \ and / characters as path separators, however \ is a valid filename character on posix systems.
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.
Additionally, a similar confusion could arise on case-insensitive filesystems. If a tar archive contained a directory at FOO, followed by a symbolic link named foo, then on case-insensitive file systems, the creation of the symbolic link would remove the directory from the filesystem, but not from the internal…
Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV
Auto-generated summary
Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.
A vulnerability tracked as CVE-2021-37701 has been found in tar.
Attackers can target a specific entry point like FOO over the network to misuse the product.
Confidential information can be exposed externally.
What to do: upgrade tar to 4.4.16 or later.
If unsure, ask your IT team or search "tar CVE-2021-37701" on the vendor's site.
CVE-2021-37701 (tar) — CWE-22
Attack vector: local / unauthenticated
Attack surface: FOO / foo / entry / entry.path
Patched: 4.4.16 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
Path traversal (CWE-22) exists in tar. Attackers reach the vulnerable code path via FOO without authentication.
Check the vendor advisory for the affected versions of tar. Attack surface: FOO / foo / entry / entry.path.
Severity: ?. Confidential information can be exposed externally.
Update to 4.4.16.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'tar' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1Identify exposure identify
grep -r 'tar' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
tarを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply patch patch
Upgrade tar to 4.4.16ステージング環境で 4.4.16 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
3Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
Fix status by distribution
Fixed packages published by each distribution for this CVE
- Alpine Linux ALPINE-CVE-2021-37701 nodejs Fixed in: 12.22.6-r0
- Debian DEBIAN-CVE-2021-37701 node-tar Fixed in: 6.1.7+~cs11.3.10-1
References
- advisory nvd.nist.gov
- package github.com
- web github.com
- web cert-portal.siemens.com
- web lists.debian.org
- web debian.org
- web npmjs.com
- web oracle.com