Improper Encoding or Escaping of Output Affecting katex package, versions >=0.11.0 <0.16.10


0.0
medium

Snyk CVSS

    Attack Complexity Low

    Threat Intelligence

    EPSS 0.04% (9th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-KATEX-6483831
  • published 26 Mar 2024
  • disclosed 25 Mar 2024
  • credit martinvks

How to fix?

Upgrade katex to version 0.16.10 or higher.

Overview

katex is a Fast math typesetting for the web.

Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output when handling the \includegraphics command. An attacker can execute arbitrary JavaScript or generate invalid HTML by exploiting the lack of proper filename escaping in the \includegraphics command.

Note:

This is only exploitable if the trust option is enabled or not properly configured to restrict the \includegraphics commands.

Workaround

This vulnerability can be mitigated by either avoiding the use of or turning off the trust option, setting it to forbid \includegraphics commands, forbidding inputs containing the substring "\\includegraphics", or sanitizing HTML output from the package.

References