Infinite Loop Vulnerability in KaTeX Package (node-katex) - CVE-2024-28244

node-katex Updated 02 Oct 2025

Summary

25/03/2024
N/A
Yes i
Unrated
Not published

DEBIAN-CVE-2024-28244: KaTeX is a JavaScript library for TeX math rendering on the web. Affects node-katex versions < 0.16.10+~cs6.1.0-1. Fixed in 0.16.10+~cs6.1.0-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

KaTeX is a popular JavaScript library designed for rendering TeX math expressions on the web. It is widely used in applications that require mathematical typesetting, providing a fast and reliable way to display complex equations. The library includes features like support for various mathematical symbols and expressions, making it a go-to choice for developers. However, a recent vulnerability has been identified that affects its ability to handle untrusted input safely.

Vulnerability Detail

The vulnerability arises from KaTeX's handling of untrusted mathematical expressions that utilize the commands '\def' or '\newcommand'. Attackers can exploit this flaw to create malicious input that triggers a near-infinite loop, even when the 'maxExpand' option is set to prevent such occurrences. This is due to the way KaTeX manages subscript and superscript groups, which instantiate separate parsers without inheriting the macro execution count from their parent. As a result, attackers can bypass the intended limits, leading to potential memory exhaustion or stack overflow errors.

How To Fix

Minimum fixed version

0.16.10+~cs6.1.0-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-katex

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary measure, users can avoid rendering untrusted mathematical expressions that utilize the vulnerable commands until the package is updated. Implementing strict input validation and sanitization for any user-generated content can also help mitigate the risk.

Conclusion

The vulnerability identified as CVE-2024-28244 in the KaTeX library poses significant risks when handling untrusted mathematical expressions. Users are strongly advised to update to the latest patched version to protect their applications from potential exploitation. Additionally, implementing workarounds and monitoring for vulnerabilities using tools like Vulert can further enhance security.

See every vulnerability recorded for node-katex →

Share this vulnerability

FAQ

CVE-2024-28244 is a vulnerability in the KaTeX library that allows attackers to exploit untrusted mathematical expressions, potentially leading to infinite loops and resource exhaustion.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.

The primary risks include memory exhaustion and stack overflow errors, which can lead to application crashes or degraded performance.

Yes, a patch is available in version 0.16.10+~cs6.1.0-1 of the node-katex package. Users should update to this version to mitigate the vulnerability.

If an immediate update is not possible, avoid rendering untrusted mathematical expressions and implement strict input validation to reduce the risk.

Related vulnerabilities

Recent vulnerabilities recorded for node-katex.

How To Fix

Minimum fixed version

0.16.10+~cs6.1.0-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-katex

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback