Miggo Logo

CVE-2022-23516: Uncontrolled Recursion in Loofah

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.06665%
Published
12/13/2022
Updated
9/14/2023
KEV Status
No
Technology
TechnologyRuby

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
loofahrubygems>= 2.2.0, < 2.19.12.19.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from recursive CDATA sanitization in Loofah versions <2.19.1. The commit diff shows the vulnerable code in scrubbers.rb's Strip#scrub method contained a conditional that recursively sanitized CDATA children using Loofah's own scrubber. This created uncontrolled recursion depth when processing nested CDATA. The patch removed this recursive pattern and replaced it with direct node manipulation and escaping logic in html5/scrub.rb, confirming the original scrub method was the recursion point.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

## Summ*ry Loo*** `>= *.*.*, < *.**.*` us*s r**ursion *or s*nitizin* `***T*` s**tions, m*kin* it sus**pti*l* to st**k *x**ustion *n* r*isin* * `Syst*mSt**k*rror` *x**ption. T*is m*y l*** to * **ni*l o* s*rvi** t*rou** *PU r*sour** *onsumption. ##

Reasoning

T** vuln*r**ility st*ms *rom r**ursiv* ***T* s*nitiz*tion in Loo*** v*rsions <*.**.*. T** *ommit *i** s*ows t** vuln*r**l* *o** in `s*ru***rs.r*`'s `Strip#s*ru*` m*t*o* *ont*in** * *on*ition*l t**t r**ursiv*ly s*nitiz** ***T* **il*r*n usin* Loo***'s