CVE-2024-28245: Vulnerability in katex package - Unescaped Filename in \includegraphics

katex Updated 02 Oct 2025

Summary

25/03/2024
Yes i
Moderate
6.3

CVE-2024-28245: KaTeX's \includegraphics does not escape filename. Affects katex versions >= 0.11.0, < 0.16.10. Fixed in 0.16.10. How to fix ↓

Also tracked for

The same CVE-2024-28245 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The katex package is an open-source library used for rendering mathematical expressions in web applications. It provides a fast and efficient way to display complex mathematical formulas on web pages. However, a vulnerability has been discovered in versions prior to 0.16.10 that allows for the inclusion of unescaped filenames in the \includegraphics command, potentially leading to the execution of arbitrary JavaScript or the generation of invalid HTML.

Vulnerability Detail

The vulnerability arises from the improper quoting of filenames in the \includegraphics command of the katex package. This allows an attacker to inject malicious input that can execute arbitrary JavaScript or generate invalid HTML. Users who render untrusted mathematical expressions using katex are at risk of encountering this vulnerability. The impact could range from the execution of malicious scripts to the generation of invalid HTML, which may disrupt the functionality of the web application or compromise user security.

How To Fix

Latest published version: 0.19.0 as of 22 Oct 2026

npm install katex@0.19.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.16.10

This is the first release that contains the fix.

npm install katex@0.16.10

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

Workaround

If upgrading to the latest version is not feasible, there are a few workarounds that can mitigate the risk:

  1. Avoid using or disable the 'trust' option, or set it to forbid the \includegraphics command.
  2. Implement input validation to forbid any inputs containing the substring '\includegraphics'.
  3. Sanitize the HTML output from katex to remove any potentially malicious or invalid content.

Conclusion

The vulnerability in the katex package allows for the inclusion of unescaped filenames in the \includegraphics command, which can lead to the execution of arbitrary JavaScript or the generation of invalid HTML. To mitigate this risk, it is recommended to upgrade to version 0.16.10 or later of the katex package. If upgrading is not possible, implementing the provided workarounds and ensuring input validation and HTML sanitization can help reduce the vulnerability's impact. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for katex →

Share this vulnerability

FAQ

The vulnerability allows for the execution of arbitrary JavaScript or the generation of invalid HTML. This can lead to the compromise of user security or the disruption of web application functionality.

Upgrading to version 0.16.10 or later of the katex package removes the vulnerability. Ensure that you are using the latest version of the package in your application.

Yes, if upgrading is not possible, you can disable the 'trust' option or implement input validation to forbid the \includegraphics command. Additionally, sanitizing the HTML output from katex can help mitigate the risk.

There are no known instances of this vulnerability being exploited in the wild. However, it is important to promptly address and fix the vulnerability to prevent any potential exploitation.

For more information, you can visit the KaTeX repository on GitHub or contact the KaTeX team at katex-security@mit.edu.

Related vulnerabilities

Recent vulnerabilities recorded for katex.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 0.19.0 as of 22 Oct 2026

npm install katex@0.19.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.16.10

This is the first release that contains the fix.

npm install katex@0.16.10

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