Packages / katex / Security

ModerateVulnerabilityGHSA-f98w-7cxr-ff2hCVE-2024-28245Published 25 Mar 2024

KaTeX's `\includegraphics` does not escape filename

Your version

Affected releases · katex

  • 0.16.x0.16.0 – 0.16.9Fixed in 0.16.10
  • 0.15.x and older0.11.0 – 0.15.6No fix, no longer updated

On 0.16.x, the newest line:

npm install katex@0.16.10
Every release on a timeline
  1. Not affected

    0.1.0 – 0.10.2

    19 releases

  2. Affected

    0.11.0 – 0.16.9

    46 releases

  3. Fixed

    0.16.10 – 0.19.1

    53 releases, latest

118 stable releases of katex, oldest to newest.

What happens

Impact

KaTeX users who render untrusted mathematical expressions could encounter malicious input using \includegraphics that runs arbitrary JavaScript, or generate invalid HTML.

Patches

Upgrade to KaTeX v0.16.10 to remove this vulnerability.

Workarounds

  • Avoid use of or turn off the trust option, or set it to forbid \includegraphics commands.

  • Forbid inputs containing the substring "\\includegraphics".

  • Sanitize HTML output from KaTeX.

Details

\includegraphics did not properly quote its filename argument, allowing it to generate invalid or malicious HTML that runs scripts.

For more information

If you have any questions or comments about this advisory:

  • Open an issue or security advisory in the KaTeX repository

  • Email us at katex-security@mit.edu

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.