Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAttacker submits \text{<img onerror=...>} as LaTeX input
-
DeliveryServer or client renders expression via MathLive <= 0.109.2
-
ExploitBox.toMarkup emits raw HTML characters unescaped
-
ExecutionRendered output assigned to innerHTML sink
-
ImpactInjected script executes in victim's browser session
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding for downstream
|
| Exploitation Conditions | Exploitation requires that the target application renders LaTeX input supplied or influenced by an untrusted party using MathLive <= 0.109.2 via any of: convertLatexToMarkup(), convertLatexToMathMl(), the <math-span> or <math-div> custom elements, or the MathfieldElement editor. The attacker must control the body content of a \text{}, \mbox{}, or similar text-mode LaTeX command - no other special server-side configuration is required. The PR:L CVSS designation indicates the attacker must have some access vector to inject LaTeX (e.g., authenticated session, form submission, URL parameter), not an open unauthenticated endpoint. Applications that only render hardcoded, developer-controlled LaTeX expressions are not affected. Exploitation is further limited by whether the rendered output is inserted into a shared DOM context visible to other users - a single-user math renderer with no persistence presents negligible cross-user risk. |
| Impact | The provided CVSS 3.1 vector (AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L, score 6.3) is broadly consistent with the vulnerability behavior. PR:L is appropriate because an attacker must have a mechanism to supply LaTeX input to the application - typically an authenticated session on a platform that accepts user-submitted math. UI:N is consistent with a stored-XSS scenario where a victim simply views rendered content without additional interaction. The S:U and C:L/I:L ratings reflect that impact is bounded to the web application's browser context, with no scope change to a separate component. EPSS data is not available; however, the existence of a functional, trivially simple PoC (a single JavaScript snippet) elevates practical exploitation probability for any application rendering untrusted LaTeX. The real-world risk is directly proportional to whether the application accepts externally controlled LaTeX - edtech platforms, collaborative math editors, and online homework systems face meaningful risk, while applications serving only developer-controlled content are unaffected. The vulnerability is not in CISA KEV, so widespread mass exploitation is not confirmed. The A:L metric in the input vector is debatable for a text-injection XSS with no inherent availability path; this analysis rates A:N. |
| Exploit ScenarioDerived | An attacker with access to a platform that renders user-supplied LaTeX (such as an online math editor or homework submission system) submits the expression \text{<img src=x onerror=alert(1)>}. When another user views the rendered result, MathLive's Box.toMarkup emits the raw HTML characters unescaped into a <span> element, which is then assigned to innerHTML, causing the browser to parse and execute the injected event handler. A complete, functional proof-of-concept is publicly documented in GitHub advisory GHSA-fm7p-gw32-828p. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 29, 2026
Cross-site scripting in MathLive (npm/mathlive <= 0.109.2) allows arbitrary JavaScript execution when applications render untrusted LaTeX containing \text{} or \mbox{} commands. The vulnerability bypassed a prior partial fix in version 0.104.0 that addressed attribute-bearing constructs but left text-content reflection in both the HTML (Box.toMarkup) and MathML (atom-to-math-ml.ts) rendering paths unescaped, with both outputs flowing into innerHTML sinks. A publicly available proof-of-concept exploit is documented in the GitHub advisory; no active exploitation has been confirmed in CISA KEV at time of analysis.
RemediationAI
Upgrade MathLive to version 0.110.0 or later, which introduces a dedicated escapeText() function in src/core/box.ts that encodes &, <, and > in HTML element content, and fixes xmlEscape in src/formats/atom-to-math-ml.ts to include & escaping across all text-mode serialization paths including scanText, <mtext>, <mi>, and delimiter elements. The fix commit is https://github.com/arnog/mathlive/commit/5fe1c46153883f9ec0249a5c8c34e64aaae9cfb8. If immediate upgrade is not feasible, the most targeted compensating control is to validate or sanitize LaTeX input before passing it to any MathLive rendering function, specifically rejecting or stripping raw HTML characters (<, >, &, ") within \text{} and \mbox{} argument bodies - be aware this may break legitimate use of typographic characters. Applications can configure MathfieldElement.createHTML to invoke a sanitizer such as DOMPurify for editor and SSR paths, but this does not protect <math-span> or <math-div> which bypass that hook entirely. Restricting LaTeX input to authenticated trusted users reduces exposure but is not a technical remediation.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
MathLive is a JavaScript/TypeScript library (pkg:npm/mathlive) for rendering and editing mathematical expressions in LaTeX. The root cause is CWE-116 (Improper Encoding or Escaping of Output). In the HTML rendering path, Box.toMarkup at src/core/box.ts:356 interpolated this.value raw into a <span> element without any HTML entity encoding - characters such as <, >, and & from \text{} or \mbox{} arguments were stored as TextAtom.value and concatenated directly into markup. In the MathML path, the xmlEscape helper in src/formats/atom-to-math-ml.ts deliberately omitted the & replacement rule, and scanText plus text-mode branches emitted atom.value raw into <mtext> elements. Both paths feed into innerHTML assignment sites in the public API. Critically, the static custom elements <math-span> and <math-div> (src/public/math-static-elements.ts:331,407) bypass the MathfieldElement.createHTML sanitization hook entirely, and that hook defaults to the identity function (src/public/mathfield-element.ts:789), providing no protection even on the paths that reach it.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
XSS via user-supplied LaTeX requires low privileges to inject; no availability impact path exists for a text-rendering XSS.
Primary rating from Vendor (https://github.com/arnog/mathlive).
CVSS VectorVendor: https://github.com/arnog/mathlive
DescriptionCVE.org
Summary
Despite 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.
Details
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.
Both 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).
PoC
- Go to https://mathlive.io/mathfield/demo/
- open DevTools console and paste:
const s = document.createElement('math-span');
s.style.display = 'block';
s.textContent = '\\text{<img src=x onerror=alert(1)>}';
document.body.appendChild(s);
s.scrollIntoView();Equivalent payloads: \mbox{<img src=x onerror=alert(1)>}
or
import { convertLatexToMarkup } from 'mathlive';
document.body.innerHTML = convertLatexToMarkup('\\text{<img src=x onerror=alert(1)>}');Impact
MathLive users who render untrusted mathematical expressions can encounter malicious input that runs arbitrary JavaScript.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
EUVD-2026-50421
GHSA-fm7p-gw32-828p
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB