{"id":"CVE-2026-54705","aliases":["CVE-2026-54705","GHSA-fm7p-gw32-828p"],"related":[],"kind":"vulnerability","state":"published","title":"mathlive's Lack of Escaping of HTML allows for XSS","summary":"MathLive provides web components for math display and input. Prior to 0.110.0, MathLive fails to escape text-mode content in \\text{} and \\mbox{} commands in Box.toMarkup at src/core/box.ts, in xmlEscape, scanText, and text-mode output in src/formats/atom-to-math-ml.ts, and through convertLatexToMarkup, convertLatexToMathMl, <math-span>, <math-div>, and the default identity MathfieldElement.createHTML, allowing malicious input to run arbitrary JavaScript when rendered. This issue is fixed in version 0.110.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"MathLive provides web components for math display and input. Prior to 0.110.0, MathLive fails to escape text-mode content in \\text{} and \\mbox{} commands in Box.toMarkup at src/core/box.ts, in xmlEscape, scanText, and text-mode output in src/formats/atom-to-math-ml.ts, and through convertLatexToMarkup, convertLatexToMathMl, <math-span>, <math-div>, and the default identity MathfieldElement.createHTML, allowing malicious input to run arbitrary JavaScript when rendered. This issue is fixed in version 0.110.0.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nDespite the 0.104.0 patch escaping attribute-bearing constructs (`\\htmlData`, `\\href`), text-content reflection was missed. The `\\text{}`, `\\mbox{}` commands accept arbitrary characters in their body and emit them raw and unescaped into both the HTML markup and the MathML output, leading to XSS.\n\n### Details\n\n`Box.toMarkup` at `src/core/box.ts:356` concatenates `this.value` into the rendered span without HTML-escaping. In text mode any literal character (`<`, `>`, `&`, `\"`) is wrapped into a `TextAtom` whose `value` is the raw codepoint and lands in the markup unchanged. The MathML serializer at `src/formats/atom-to-math-ml.ts` is independently broken: `xmlEscape` deliberately omits the `&` rule, and `scanText`, `case 'text'`, and the `mode === 'text'` early return all emit `atom.value` raw.\n\nBoth outputs flow into `innerHTML` sinks via the public API. `<math-span>` / `<math-div>` (`src/public/math-static-elements.ts:331,407`) bypass `MathfieldElement.createHTML` entirely. The editor and SSR paths route through `createHTML`, but its default value is the identity function (`src/public/mathfield-element.ts:789`).\n\n### PoC\n\n1. Go to https://mathlive.io/mathfield/demo/\n2. open DevTools console and paste:\n\n```js\nconst s = document.createElement('math-span');\ns.style.display = 'block';\ns.textContent = '\\\\text{<img src=x onerror=alert(1)>}';\ndocument.body.appendChild(s);\ns.scrollIntoView();\n```\n\nEquivalent payloads: `\\mbox{<img src=x onerror=alert(1)>}`\n\nor\n\n```js\nimport { convertLatexToMarkup } from 'mathlive';\ndocument.body.innerHTML = convertLatexToMarkup('\\\\text{<img src=x onerror=alert(1)>}');\n```\n\n### Impact\n\nMathLive users who render untrusted mathematical expressions can encounter malicious input that runs arbitrary JavaScript.","format":"markdown","source":"ghsa"},{"lang":"es","text":"MathLive proporciona componentes web para la visualización e introducción de matemáticas. Antes de 0.110.0, MathLive falla al escapar el contenido en modo texto en los comandos \\text{} y \\mbox{} en Box.toMarkup en src/core/box.ts, en xmlEscape, scanText, y la salida en modo texto en src/formats/atom-to-math-ml.ts, y a través de convertLatexToMarkup, convertLatexToMathMl, [math-span], [math-div], y la identidad predeterminada MathfieldElement.createHTML, permitiendo que una entrada maliciosa ejecute JavaScript arbitrario cuando se renderiza. Este problema está solucionado en la versión 0.110.0.","source":"nvd"}],"published":"2026-07-29T17:21:20.414Z","modified":"2026-10-24T13:10:00.147Z","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"}],"cwes":["CWE-116"],"affected":[{"ranges":[{"version":"< 0.110.0","status":"affected"}],"vendor":"arnog","product":"mathlive","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.110.0"}],"ecosystem":"npm","package":"mathlive","purl":"pkg:npm/mathlive","source":"ghsa"}],"references":[{"url":"https://github.com/arnog/mathlive/security/advisories/GHSA-fm7p-gw32-828p","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/arnog/mathlive/issues/3028","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/arnog/mathlive/commit/5fe1c46153883f9ec0249a5c8c34e64aaae9cfb8","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/arnog/mathlive","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-07-29T17:54:40.585Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-54705","url":"https://www.cve.org/CVERecord?id=CVE-2026-54705","licence":"CVE Terms of Use","modified":"2026-07-29T17:54:49.618Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-fm7p-gw32-828p","url":"https://github.com/advisories/GHSA-fm7p-gw32-828p","licence":"CC-BY-4.0","modified":"2026-07-29T17:41:44.693Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-54705","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-54705","licence":"Public domain","modified":"2026-10-24T13:10:00.147Z"}],"updatedAt":"2026-11-25T22:59:30.463Z","epss":{"score":0.00299,"percentile":0.24364,"date":"2026-12-01T12:00:22.000Z"}}