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


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    EPSS
    0.04% (11th 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

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
6.3 medium
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    Low
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    Low
  • Integrity (I)
    Low
  • Availability (A)
    Low