{"id":"CVE-2026-54705","aliases":["EUVD-2026-50421","GHSA-fm7p-gw32-828p"],"status":"published","title":"mathlive's Lack of Escaping of HTML allows for XSS","description":"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, \u003cmath-span\u003e, \u003cmath-div\u003e, and the default identity MathfieldElement.createHTML, allowing malicious input to run arbitrary JavaScript when rendered. This issue is fixed in version 0.110.0.","severity":{"version":"3.1","score":6.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-11","score":0.00299,"percentile":0.22899,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-116"],"published":"2026-07-29T17:21:20Z","modified":"2026-10-28T02:30:29Z","fixes":[{"ecosystem":"npm","package":"mathlive","fixed_in":["0.110.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"mathlive","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"0.109.2"},{"fixed":"0.110.0"}]}]},{"source":"osv","ecosystem":"npm","package":"mathlive","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.110.0"}]}]}],"products":[{"vendor":"arnog","product":"mathlive"}],"references":[{"url":"https://github.com/arnog/mathlive/security/advisories/GHSA-fm7p-gw32-828p","tags":["x_refsource_CONFIRM","exploit","advisory","web"]},{"url":"https://github.com/arnog/mathlive/issues/3028","tags":["x_refsource_MISC","report","web"]},{"url":"https://github.com/arnog/mathlive/commit/5fe1c46153883f9ec0249a5c8c34e64aaae9cfb8","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/advisories/GHSA-fm7p-gw32-828p"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/54xxx/CVE-2026-54705.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-54705","tags":["advisory"]},{"url":"https://github.com/arnog/mathlive","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-54705","title":"mathlive's Lack of Escaping of HTML allows for XSS","description":"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, \u003cmath-span\u003e, \u003cmath-div\u003e, and the default identity MathfieldElement.createHTML, allowing malicious input to run arbitrary JavaScript when rendered. This issue is fixed in version 0.110.0.","status":"published","published":"2026-07-29T17:21:20.414Z","modified":"2026-07-29T17:54:49.618Z","cvss":[{"version":"3.1","score":6.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","level":"medium","assessor":"cna"}],"cwes":["CWE-116"],"updated_at":"2026-11-02T13:37:58.613221Z"}],"euvd":[{"id":"EUVD-2026-50421","description":"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, \u003cmath-span\u003e, \u003cmath-div\u003e, and the default identity MathfieldElement.createHTML, allowing malicious input to run arbitrary JavaScript when rendered. This issue is fixed in version 0.110.0.","status":"published","published":"2026-07-29T17:21:20Z","modified":"2026-07-29T17:54:49Z","cvss":[{"version":"3.1","score":6.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","level":"medium"}],"updated_at":"2026-11-02T18:02:29.807737Z"}],"ghsa":[{"id":"GHSA-fm7p-gw32-828p","title":"mathlive's Lack of Escaping of HTML allows for XSS","description":"### 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 (`\u003c`, `\u003e`, `\u0026`, `\"`) 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 `\u0026` 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. `\u003cmath-span\u003e` / `\u003cmath-div\u003e` (`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{\u003cimg src=x onerror=alert(1)\u003e}';\ndocument.body.appendChild(s);\ns.scrollIntoView();\n```\n\nEquivalent payloads: `\\mbox{\u003cimg src=x onerror=alert(1)\u003e}`\n\nor\n\n```js\nimport { convertLatexToMarkup } from 'mathlive';\ndocument.body.innerHTML = convertLatexToMarkup('\\\\text{\u003cimg src=x onerror=alert(1)\u003e}');\n```\n\n### Impact\n\nMathLive users who render untrusted mathematical expressions can encounter malicious input that runs arbitrary JavaScript.","status":"published","published":"2026-07-29T17:21:26Z","modified":"2026-07-29T17:21:27Z","cvss":[{"version":"3.1","score":6.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","level":"medium"}],"cwes":["CWE-116"],"updated_at":"2026-11-02T14:40:54.767849Z"}],"nvd":[{"id":"CVE-2026-54705","description":"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, \u003cmath-span\u003e, \u003cmath-div\u003e, and the default identity MathfieldElement.createHTML, allowing malicious input to run arbitrary JavaScript when rendered. This issue is fixed in version 0.110.0.","status":"published","published":"2026-07-29T18:16:54.857Z","modified":"2026-10-24T13:10:00.147Z","cvss":[{"version":"3.1","score":6.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","level":"medium","assessor":"secondary"}],"cwes":["CWE-116"],"updated_at":"2026-11-02T14:12:33.629616Z"}],"osv":[{"id":"CVE-2026-54705","title":"mathlive's Lack of Escaping of HTML allows for XSS","description":"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, \u003cmath-span\u003e, \u003cmath-div\u003e, and the default identity MathfieldElement.createHTML, allowing malicious input to run arbitrary JavaScript when rendered. This issue is fixed in version 0.110.0.","status":"published","published":"2026-07-29T17:21:20.414Z","modified":"2026-10-28T02:30:29.965017831Z","cvss":[{"version":"3.1","score":6.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","level":"medium"}],"cwes":["CWE-116"],"updated_at":"2026-11-02T15:45:10.818486Z"},{"id":"GHSA-fm7p-gw32-828p","title":"mathlive's Lack of Escaping of HTML allows for XSS","description":"### 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 (`\u003c`, `\u003e`, `\u0026`, `\"`) 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 `\u0026` 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. `\u003cmath-span\u003e` / `\u003cmath-div\u003e` (`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{\u003cimg src=x onerror=alert(1)\u003e}';\ndocument.body.appendChild(s);\ns.scrollIntoView();\n```\n\nEquivalent payloads: `\\mbox{\u003cimg src=x onerror=alert(1)\u003e}`\n\nor\n\n```js\nimport { convertLatexToMarkup } from 'mathlive';\ndocument.body.innerHTML = convertLatexToMarkup('\\\\text{\u003cimg src=x onerror=alert(1)\u003e}');\n```\n\n### Impact\n\nMathLive users who render untrusted mathematical expressions can encounter malicious input that runs arbitrary JavaScript.","status":"published","published":"2026-07-29T17:21:26Z","modified":"2026-07-29T17:41:44.693943Z","cvss":[{"version":"3.1","score":6.3,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L","level":"medium"}],"cwes":["CWE-116"],"updated_at":"2026-11-02T15:46:46.760785Z"}]}}
