Critical Vulnerability in Node-Katex: Infinite Loop Risk from Untrusted Input

node-katex Updated 03 Oct 2025

Summary

25/03/2024
N/A
Yes i
Medium
6.5

UBUNTU-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-2. Fixed in 0.16.10+~cs6.1.0-2. 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 Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Node-Katex is a JavaScript library designed for rendering TeX math expressions on the web. It allows users to create complex mathematical notations easily. However, it has a known vulnerability that can be exploited when rendering untrusted mathematical expressions, particularly through the use of specific commands that can lead to performance issues.

Vulnerability Detail

The vulnerability arises from the way Node-Katex handles certain commands like '\def' and '\newcommand'. When these commands are used with untrusted input, they can create a near-infinite loop, consuming excessive memory and potentially causing a stack overflow. This issue is exacerbated by the library's support for Unicode subscript and superscript characters, which allows attackers to bypass the 'maxExpand' limit intended to prevent such loops. The vulnerability is identified as CVE-2024-28244 and has a CVSS score of 6.5, indicating a medium severity level.

How To Fix

Minimum fixed version

0.16.10+~cs6.1.0-2

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 workaround, avoid rendering untrusted mathematical expressions that utilize the '\def' or '\newcommand' commands until the package is updated. Additionally, consider sanitizing input to prevent malicious commands from being processed.

Conclusion

The vulnerability in Node-Katex (CVE-2024-28244) poses a serious risk when rendering untrusted mathematical expressions. It is crucial to update to the patched version to mitigate potential threats. Users should also implement input sanitization as a temporary measure until the update is applied.

See every vulnerability recorded for node-katex →

Share this vulnerability

FAQ

CVE-2024-28244 is a vulnerability in Node-Katex that allows attackers to create infinite loops through untrusted mathematical expressions, potentially leading to performance degradation.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

If left unaddressed, this vulnerability can lead to application crashes, excessive memory consumption, and denial of service due to infinite loops triggered by malicious input.

Yes, you can prevent exploitation by sanitizing user input and avoiding the use of potentially dangerous commands in untrusted contexts until the package is updated.

The vulnerability has a CVSS score of 6.5, indicating a medium severity level, which means it poses a significant risk that should be addressed promptly.

Related vulnerabilities

Recent vulnerabilities recorded for node-katex.

How To Fix

Minimum fixed version

0.16.10+~cs6.1.0-2

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