Miggo Logo

CVE-2022-25887: Sanitize-html Vulnerable To REDoS Attacks

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.15664%
Published
8/31/2022
Updated
4/22/2024
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
sanitize-htmlnpm< 2.7.12.7.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability was specifically patched by replacing a regex-based comment removal approach with manual string operations in index.js. The commit diff shows the vulnerable regex pattern was used in href sanitization within the main sanitizeHtml() function. The CWE-1333 classification and advisory descriptions confirm this was a regex efficiency issue in comment handling, making the sanitizeHtml() function's comment removal logic the clear vulnerable point.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

T** p**k*** s*nitiz*-*tml ***or* *.*.* *r* vuln*r**l* to R**ul*r *xpr*ssion **ni*l o* S*rvi** (R**oS) *u* to ins**ur* *lo**l r**ul*r *xpr*ssion r*pl***m*nt lo*i* o* *TML *omm*nt r*mov*l.

Reasoning

T** vuln*r**ility w*s sp**i*i**lly p*t**** *y r*pl**in* * r***x-**s** *omm*nt r*mov*l *ppro*** wit* m*nu*l strin* op*r*tions in `in**x.js`. T** *ommit *i** s*ows t** vuln*r**l* r***x p*tt*rn w*s us** in *r** s*nitiz*tion wit*in t** m*in `s*nitiz**tml