Skip to main content

MathLive EUVDEUVD-2026-50421

| CVE-2026-54705 MEDIUM
Improper Encoding or Escaping of Output (CWE-116)
2026-07-29 https://github.com/arnog/mathlive GHSA-fm7p-gw32-828p
6.3
CVSS 3.1 · Vendor: https://github.com/arnog/mathlive
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Attacker submits \text{<img onerror=...>} as LaTeX input
  2. Delivery
    Server or client renders expression via MathLive <= 0.109.2
  3. Exploit
    Box.toMarkup emits raw HTML characters unescaped
  4. Execution
    Rendered output assigned to innerHTML sink
  5. Impact
    Injected 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.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

mathlive < 0.110.0

Affected Packages

npm mathlive fix: 0.110.0

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

Vendor (https://github.com/arnog/mathlive) PRIMARY 6.3 MEDIUM
AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
vuln.today AI 5.4 MEDIUM

XSS via user-supplied LaTeX requires low privileges to inject; no availability impact path exists for a text-rendering XSS.

3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N
4.0 AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/arnog/mathlive).

CVSS VectorVendor: https://github.com/arnog/mathlive

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
Low

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

  1. Go to https://mathlive.io/mathfield/demo/
  2. open DevTools console and paste:
js
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

js
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.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 79 npm packages depend on mathlive (22 direct, 58 indirect)

Ecosystem-wide dependent count for version 0.110.0.

Threat Intelligence Overview

EPSS Score
0.2%
Top 89% exploitable
Prevalence
Medium
popular math-rendering npm library, widely used in edtech and scientific web apps
Threat Intel
1
1 sources
Exploit
POC
Public exploit code exists
Data Quality
6 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA GitHub

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.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC Yes
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

52
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +32
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy