Miggo Logo

CVE-2018-20835: Improper Input Validation in tar-fs

7.5

CVSS Score
3.0

Basic Information

EPSS Score
0.51945%
Published
5/1/2019
Updated
2/1/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
tar-fsnpm< 1.16.21.16.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The key vulnerability stemmed from improper path resolution when handling hardlinks during extraction. The commit 0667282 shows the fix changed from path.resolve(cwd, header.linkname) to path.join(cwd, path.join('/', header.linkname)), which prevents path traversal by normalizing the link target path relative to the extraction directory. This function was directly responsible for validating() hardlink targets, and its lack of proper input validation allowed overwriting arbitrary existing files through specially crafted tarballs.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

* vuln*r**ility w*s *oun* in t*r-*s ***or* *.**.*. *n *r*itr*ry *il* Ov*rwrit* issu* *xists w**n *xtr**tin* * t*r**ll *ont*inin* * **r*link to * *il* t**t *lr***y *xists on t** syst*m, in *onjun*tion wit* * l*t*r pl*in *il* wit* t** s*m* n*m* *s t**

Reasoning

T** k*y vuln*r**ility st*mm** *rom improp*r p*t* r*solution w**n **n*lin* **r*links *urin* *xtr**tion. T** *ommit ******* s*ows t** *ix ***n*** *rom `p*t*.r*solv*(*w*, *****r.linkn*m*)` to `p*t*.join(*w*, p*t*.join('/', *****r.linkn*m*))`, w*i** pr*v