6.3medium
\htmlData does not validate attribute names in KaTeX
- Severity
- 6.3medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.41% (higher than 36% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-cg87-wmx4-v546
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| KaTeX KaTeX | >= 0.12.0, < 0.16.21, from 0.12.0 before 0.16.21 | CVE List, NVD |
| katex (npm) | from 0.12.0 before 0.16.21 | GitHub Advisory Database |
All scores
| GitHub_M | 6.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L |
| GitHub | 6.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L |
| NVD | 7.2high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N |
Classification
What each source says
CVE List
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.
GitHub Advisory Database
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 katex-security@mit.edu
NVD (es)
KaTeX es una Librería de JavaScript rápida y fácil de usar para la representación matemática de TeX en la web. Los usuarios de KaTeX que representen expresiones matemáticas no confiables con `renderToString` podrían encontrarse con entradas maliciosas utilizando `\htmlData` que ejecutan JavaScript arbitrario o generan HTML no válido. Se recomienda a los usuarios que actualicen a KaTeX v0.16.21 para eliminar esta vulnerabilidad. Los usuarios que no puedan actualizar deben evitar el uso de la opción `trust` o desactivarla, o configurarla para prohibir los comandos `\htmlData`, prohibir las entradas que contengan la subcadena `"\\htmlData"` y la salida HTML Desinfectar de KaTeX.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-23207 changed 2025-01-17 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-cg87-wmx4-v546 changed 2025-01-21 | CC-BY-4.0 |
| NVD | CVE-2025-23207 changed 2026-06-17 | Public domain |