CVE-2024-28244

KaTeX's maxExpand bypassed by Unicode sub/superscripts

Published Mar 25, 2024 CVSS 3.1 · 6.5 Medium EPSS 2.2% KEV · Not listed
Description
KaTeX is a JavaScript library for TeX math rendering on the web. KaTeX users who render untrusted mathematical expressions could encounter malicious input using `\def` or `\newcommand` that causes a near-infinite loop, despite setting `maxExpand` to avoid such loops. KaTeX supports an option named maxExpand which aims to prevent infinitely recursive macros from consuming all available memory and/or triggering a stack overflow error. Unfortunately, support for "Unicode (sub|super)script characters" allows an attacker to bypass this limit. Each sub/superscript group instantiated a separate Parser with its own limit on macro executions, without inheriting the current count of macro executions from its parent. This has been corrected in KaTeX v0.16.10.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
EUVD EUVD EUVD-2024-0906 KaTeX is a JavaScript library for TeX math rendering on the web. KaTeX users who render untrusted mathematical expressions could encounter malicious input using `\def` or `\newcommand` that causes a near-infinite loop, despite setting `maxExpand` to avoid such loops. KaTeX supports an option named maxExpand which aims to prevent infinitely recursive macros from consuming all available memory and/or triggering a stack overflow error. Unfortunately, support for "Unicode (sub|super)script characters" allows an attacker to bypass this limit. Each sub/superscript group instantiated a separate Parser with its own limit on macro executions, without inheriting the current count of macro executions from its parent. This has been corrected in KaTeX v0.16.10.
Github GHSA Github GHSA GHSA-cvr6-37gx-v8wc KaTeX's maxExpand bypassed by Unicode sub/superscripts
History
Type Values Removed Values Added
CPEs cpe:2.3:a:katex:katex:*:*:*:*:*:*:*:*
Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Aug 2, 2024, 12:48 AM
Reserved
Mar 7, 2024, 2:33 PM
Status
Analyzed
Published
Mar 25, 2024, 8:15 PM
Modified
Jun 17, 2026, 7:21 AM