{"id":"CVE-2025-23207","aliases":["CVE-2025-23207","GHSA-cg87-wmx4-v546"],"related":[],"kind":"vulnerability","state":"published","title":"\\htmlData does not validate attribute names in KaTeX","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Impact\nKaTeX users who render untrusted mathematical expressions with `renderToString` could encounter malicious input using `\\htmlData` that runs arbitrary JavaScript, or generate invalid HTML.\n\n### Patches\nUpgrade to KaTeX v0.16.21 to remove this vulnerability.\n\n### Workarounds\n- Avoid use of or turn off the `trust` option, or set it to forbid `\\htmlData` commands.\n- Forbid inputs containing the substring `\"\\\\htmlData\"`.\n- Sanitize HTML output from KaTeX.\n\n### Details\n`\\htmlData` did not validate its attribute name argument, allowing it to generate invalid or malicious HTML that runs scripts.\n\n### For more information\nIf you have any questions or comments about this advisory:\n\n- Open an issue or security advisory in the [KaTeX repository](https://github.com/KaTeX/KaTeX/)\n- Email us at [katex-security@mit.edu](mailto:katex-security@mit.edu)","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2025-01-17T21:22:56.000Z","modified":"2026-06-17T08:52:38.510Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","score":6.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","score":6.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","score":6.3,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N","score":7.2,"rating":"HIGH"}],"cwes":["CWE-79","CWE-116"],"affected":[{"ranges":[{"version":">= 0.12.0, < 0.16.21","status":"affected"}],"vendor":"KaTeX","product":"KaTeX","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.12.0","status":"affected","fixed":"0.16.21"}],"ecosystem":"npm","package":"katex","purl":"pkg:npm/katex","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"0.12.0","fixed":"0.16.21"}],"vendor":"katex","product":"katex","cpe":"cpe:2.3:a:katex:katex:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/KaTeX/KaTeX/security/advisories/GHSA-cg87-wmx4-v546","tags":["third-party-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/KaTeX/KaTeX/commit/ff289955e81aab89086eef09254cbf88573d415c","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-23207","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/KaTeX/KaTeX","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-01-17T21:32:10.973Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-23207","url":"https://www.cve.org/CVERecord?id=CVE-2025-23207","licence":"CVE Terms of Use","modified":"2025-01-17T21:32:24.984Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cg87-wmx4-v546","url":"https://github.com/advisories/GHSA-cg87-wmx4-v546","licence":"CC-BY-4.0","modified":"2025-01-21T18:31:02.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-23207","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-23207","licence":"Public domain","modified":"2026-06-17T08:52:38.510Z"}],"updatedAt":"2026-11-25T22:58:53.418Z","epss":{"score":0.00406,"percentile":0.36953,"date":"2026-12-01T12:00:22.000Z"}}