CVE-2018-20834: Arbitrary File Overwrite in tar
7.5
CVSS Score
3.0
Basic Information
CVE ID
GHSA ID
EPSS Score
0.60924%
CWE
Published
5/1/2019
Updated
11/29/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
tar | npm | < 2.2.2 | 2.2.2 |
tar | npm | >= 3.0.0, < 4.4.2 | 4.4.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from improper handling of hardlinks during tarball extraction. The pre-patch code in CHECKFS
methods allowed overwriting existing files if they matched the entry type, without checking if they were part of a hardlink chain (nlink >1). The commit introduced an ISREUSABLE
check that enforces nlink <=1 for file reuse, explicitly preventing hardlink overwrites. The test case added in the commit demonstrates protection against this scenario by verifying nlink=1 after extraction.