CVE-2025-23207 is a medium-severity (CVSS 6.3) CWE-116 vulnerability in katex. A fix is available for katex — see the affected versions and patch details below.
\htmlData does not validate attribute names in KaTeX
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2025-23207.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
katexnpmDescription
Impact
KaTeX users who render untrusted mathematical expressions with renderToString could encounter malicious input using \htmlData that runs arbitrary JavaScript, or generate invalid HTML.
Patches
Upgrade to KaTeX v0.16.21 to remove this vulnerability.
Workarounds
- Avoid use of or turn off the
trustoption, or set it to forbid\htmlDatacommands. - Forbid inputs containing the substring
"\\htmlData". - Sanitize HTML output from KaTeX.
Details
\htmlData did not validate its attribute name 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 [email protected]
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | katex | ≥ 0.12.0&&< 0.16.21 | 0.16.21npm install katex@0.16.21 |
Affected Products
katexkatexDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for katex, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update katex to 0.16.21 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-23207 is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
Users unable to upgrade should turn off the `trust` option or set it to forbid `\htmlData` commands, forbid inputs containing the substring `"\\htmlData"` and sanitize HTML output from KaTeX.Source: Red Hat security advisory for CVE-2025-23207 (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat OpenShift Dev Spaces 3 Containers | devspaces/code-rhel9:3.19-20 | RHSA-2025:2753 |
Frequently Asked Questions
Is CVE-2025-23207 in your dependencies?
Find it across npm, including transitive dependencies.