Miggo Logo

CVE-2022-25931: easy-static-server vulnerable to Directory Traversal

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.53615%
Published
12/20/2022
Updated
1/27/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:N/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
easy-static-servernpm<= 0.1.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from line 27 in index.js where user-controlled req.url is parsed and joined with the root directory without proper path normalization or sandboxing. The code uses path.join() which doesn't resolve relative paths when combined with user input, allowing attackers to use '../' sequences to access files outside the intended directory. The lack of additional checks like path.resolve(), path.normalize(), or root directory validation makes this a clear path traversal vulnerability. The proof of concept demonstrates this by accessing ../../package.json, confirming the exploit works as described.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

*ll v*rsions o* p**k*** **sy-st*ti*-s*rv*r *r* vuln*r**l* to *ir**tory Tr*v*rs*l *u* to missin* input s*nitiz*tion *n* s*n**ox*s **in* *mploy** to t** `r*q.url` us*r input t**t is p*ss** to t** s*rv*r *o**.

Reasoning

T** vuln*r**ility st*ms *rom lin* ** in in**x.js w**r* us*r-*ontroll** r*q.url is p*rs** *n* join** wit* t** root *ir**tory wit*out prop*r p*t* norm*liz*tion or s*n**oxin*. T** *o** us*s p*t*.join() w*i** *o*sn't r*solv* r*l*tiv* p*t*s w**n *om*in**