CVE-2024-28244 KaTeX's maxExpand bypassed by Unicode sub/superscripts
Attackers can bypass KaTeX's maxExpand limit using Unicode sub/superscripts to cause infinite loops and denial of service.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-28244?
CVE-2024-28244 is a medium-severity denial of service vulnerability in KaTeX, published on 25 Mar 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Official 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.
Weakness: CWE-674
Which versions are affected by CVE-2024-28244?
2 open source packages ship an affected version, including katex. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
katex npm | From 0.15.4 | 0.16.10 |
katex npm | From 0.15.4 | 0.16.10 |
Products include Katex Katex.
How do I fix CVE-2024-28244?
Upgrade katex to 0.16.10 or later.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2024-28244 being exploited?
There is no known exploitation of CVE-2024-28244 in the wild and no public exploit code.
Other vulnerabilities in KaTeX
Sources
Also known as DEBIAN-CVE-2024-28244, GHSA-cvr6-37gx-v8wc.