XSS in Katex

CVE-2025-23207

KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web. KaTeX users who render untrusted mathematical expressions with `renderToString` could encounter malicious input using `\htmlData` that runs arbitrary JavaScript, or generate invalid HTML. Users are advised to upgrade to KaTeX v0.16.21 to remove this vulnerability. Users unable to upgrade should avoid use of or turn off the `trust` option, or set it to forbid `\htmlData` commands, forbid inputs containing the substring `"\\htmlData"` and sanitize HTML output from KaTeX.

EPSS: 0.004 (33.3th percentile) — read the EPSS interpretation.

CVSS v3 metric

CVSS v3 base score 6.3 (Medium). Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L.

Affected products

  • Katex — versions >= 0.12.0, < 0.16.21

Weakness classification (CWE)

References

Frequently asked questions

What is CVE-2025-23207?
CVE-2025-23207 is a medium-severity vulnerability in Katex, classified under Improper Encoding or Escaping of Output. CVSS score: 6.3/10. Published 2025-01-17.
How severe is CVE-2025-23207?
Medium severity. CVSS v3 base score is 6.3 out of 10.