Miggo Logo

CVE-2022-21186: @acrontum/filesystem-template vulnerable to Command Injection due to fetchRepo API missing sanitization

9.8

CVSS Score
3.1

Basic Information

EPSS Score
0.96214%
Published
8/6/2022
Updated
8/17/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
@acrontum/filesystem-templatenpm< 0.0.20.0.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the fetchRepo function's handling of the URL parameter. The patch removed the URL parameter entirely (changed from fetchRepo(url, cacheInfo, options) to fetchRepo(cacheInfo, options)), indicating the URL's href field was the injection vector. Pre-patch, attackers could supply a crafted href value (e.g., '|touch /tmp/rce') that would be executed during repository cloning. The CWE-77 classification and Snyk's PoC confirm command injection via unsanitized URL input in this function.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

T** p**k*** @**rontum/*il*syst*m-t*mpl*t* ***or* *.*.* is vuln*r**l* to *r*itr*ry *omm*n* Inj**tion *u* to t** **t**R*po *PI missin* s*nitiz*tion o* t** *r** *i*l* o* *xt*rn*l input.

Reasoning

T** vuln*r**ility st*ms *rom t** **t**R*po *un*tion's **n*lin* o* t** URL p*r*m*t*r. T** p*t** r*mov** t** URL p*r*m*t*r *ntir*ly (***n*** *rom **t**R*po(url, *****In*o, options) to **t**R*po(*****In*o, options)), in*i**tin* t** URL's *r** *i*l* w*s