Miggo Logo

CVE-2024-56198: path-sanitizer allows bypassing the existing filters to achieve path-traversal vulnerability

N/A

CVSS Score

Basic Information

EPSS Score
0.45329%
Published
1/2/2025
Updated
1/2/2025
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
path-sanitizernpm< 3.1.03.1.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the sanitize function's inadequate handling of:

  1. URL-encoded characters like %5c (backslash) that could be used to bypass slash-based filtering
  2. Recursive parent directory patterns that weren't properly normalized in a loop
  3. Multiple consecutive traversal sequences that could escape the target directory

The commit diff shows critical changes in lib/index.ts adding a while loop and additional regex patterns to address these issues, confirming the original implementation in this file was vulnerable. The PoC demonstrates that specially crafted inputs could bypass the original sanitization logic through encoding and path concatenation attacks.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Summ*ry T*is is * PO* *or * p*t*-s*nitiz*r [npm p**k***](*ttps://www.npmjs.*om/p**k***/p*t*-s*nitiz*r). T** *ilt*rs **n ** *yp*ss** *n* **n r*sult in p*t* tr*v*rs*l. P*ylo**: `..=%**` **n ** us** to *yp*ss t*is on *LI (*lon* wit* ot**r **n*i**t*

Reasoning

T** vuln*r**ility st*ms *rom t** s*nitiz* *un*tion's in***qu*t* **n*lin* o*: *. URL-*n*o*** ***r**t*rs lik* %** (***ksl*s*) t**t *oul* ** us** to *yp*ss sl*s*-**s** *ilt*rin* *. R**ursiv* p*r*nt *ir**tory p*tt*rns t**t w*r*n't prop*rly norm*liz** in