Unchecked Input for Loop Condition Affecting katex package, versions >=0.10.0-beta <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-6483835
  • published 26 Mar 2024
  • disclosed 25 Mar 2024
  • credit Juho Nurminen

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 Unchecked Input for Loop Condition when handling \edef commands. An attacker can cause a near-infinite loop, leading to memory overflow, tying up the main thread, or stack overflow by crafting malicious input using \edef that bypasses the maxExpand setting designed to prevent such issues.

Note:

This vulnerability is particularly concerning for users who render untrusted mathematical expressions, as it can be exploited to perform an availability attack, rendering the service unusable.

Workaround

This vulnerability can be mitigated by forbidding inputs containing the substring "\\edef" before passing them to the affected package.

References

CVSS Scores

version 3.1
Expand this section

Snyk

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