Miggo Logo

CVE-2024-28244: KaTeX's maxExpand bypassed by Unicode sub/superscripts

6.5

CVSS Score
3.1

Basic Information

EPSS Score
0.33781%
Published
3/25/2024
Updated
3/25/2024
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
katexnpm>= 0.15.4, < 0.16.100.16.10

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from how Unicode sub/superscript handling was implemented in Parser.js. The original code (pre-patch) created a new Parser instance (new Parser(str, this.settings).parse()) for each sub/superscript group, which reset the macro expansion counter for each new parser. This violated the intended maxExpand protection by allowing recursive macro expansions across multiple parser instances. The fix replaced this with this.subparse() which maintains the same parser context and expansion counter. The commit diff and CVE description both explicitly identify this code path as the root cause.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Imp**t K*T*X us*rs w*o r*n**r untrust** m*t**m*ti**l *xpr*ssions *oul* *n*ount*r m*li*ious input usin* `\***` or `\n*w*omm*n*` t**t **us*s * n**r-in*init* loop, **spit* s*ttin* `m*x*xp*n*` to *voi* su** loops. T*is **n ** us** *s *n *v*il**ility

Reasoning

T** vuln*r**ility st*ms *rom *ow Uni*o** su*/sup*rs*ript **n*lin* w*s impl*m*nt** in P*rs*r.js. T** ori*in*l *o** (pr*-p*t**) *r**t** * n*w P*rs*r inst*n** (`n*w P*rs*r(str, t*is.s*ttin*s).p*rs*()`) *or **** su*/sup*rs*ript *roup, w*i** r*s*t t** m**