CVE-2025-29049: Mathlive Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-qwj6-q94f-8425
CVSS 6.3
CWE-116 CWE-79
Published
Advisory Summary

CVE-2025-29049 is a MODERATE (CVSS 6.3) cross-site scripting vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting Mathlive libraries in the npm ecosystem. The issue involves mathlive's lack of escaping of html allows for xss. Remediation is available by upgrading affected packages to version 0.104.0.

CVE-2025-29049 at a Glance

CVE Identifier CVE-2025-29049
GHSA Identifier GHSA-qwj6-q94f-8425
Severity MODERATE
CVSS v3.1 Base Score 6.3
CWE Classification CWE-116: Improper Encoding or Escaping of Output
Affected Product Mathlive
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2025-29049

To remediate this vulnerability, upgrade all affected Mathlive dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mathlive fixed: 0.104.0
npm install mathlive@0.104.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls mathlive

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-29049, inspect your project dependencies using npm:

npm ls mathlive

Analyze the terminal output to locate any version of Mathlive in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.104.0), your application is affected.

Note: The npm ls mathlive command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. In Mathlive, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Despite normal text rendering as LaTeX expressions, preventing XSS, the library also provides users with commands which may modify HTML, such as the `\htmlData` command, and the lack of escaping leads to XSS. ### Details Overall in the code, other than in the `test` folder, no functions escaping HTML can be seen. ### PoC 1. Go to https://cortexjs.io/mathlive/demo/ 2. Paste either `\htmlData{><img/onerror=alert(1)"src=}{}` or `\htmlData{x=" ><img/onerror=alert(1) src>}{}` in the LaTeX textarea. ### Impact MathLive users who render untrusted mathematical expressions could encounter malicious input using \htmlData that runs arbitrary JavaScript, or generate invalid HTML.

CVE-2025-29049 Affected Mathlive Versions

1 component(s)
Fixed Versions:
0.104.0
Product / Package Ecosystem Affected Versions Fixed Version
mathlive
npm
< 0.104.0
0.104.0

References

Frequently Asked Questions

What is CVE-2025-29049?
CVE-2025-29049 is a security vulnerability in Mathlive involving MathLive's Lack of Escaping of HTML allows for XSS under CWE-116: Improper Encoding or Escaping of Output.
Which Mathlive versions are affected?
Affected versions include releases prior to 0.104.0 across affected packages: mathlive.
What version fixes CVE-2025-29049?
Upgrading to 0.104.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mathlive affected?
Yes, mathlive is affected in releases prior to 0.104.0. Upgrade your dependency to 0.104.0 or later.
What is the CVSS score of CVE-2025-29049?
CVE-2025-29049 has a CVSS v3.1 base score of 6.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2025-29049?
CVE-2025-29049 is classified under CWE-116: Improper Encoding or Escaping of Output (The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.).
How can I check npm dependencies for CVE-2025-29049?
Run the dependency tree command: 'npm ls mathlive'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qwj6-q94f-8425",
  "modified" : "2025-04-02T00:33:42Z",
  "published" : "2025-01-21T21:17:52Z",
  "aliases" : [ "CVE-2025-29049" ],
  "summary" : "MathLive's Lack of Escaping of HTML allows for XSS",
  "details" : "### Summary\nDespite normal text rendering as LaTeX expressions, preventing XSS, the library also provides users with commands which may modify HTML, such as the `\\htmlData` command, and the lack of escaping leads to XSS.\n\n### Details\nOverall in the code, other than in the `test` folder, no functions escaping HTML can be seen.\n\n### PoC\n1. Go to https://cortexjs.io/mathlive/demo/\n2. Paste either `\\htmlData{><img/onerror=alert(1)\"src=}{}` or `\\htmlData{x=\" ><img/onerror=alert(1) src>}{}` in the LaTeX textarea.\n\n### Impact\nMathLive users who render untrusted mathematical expressions could encounter malicious input using \\htmlData that runs arbitrary JavaScript, or generate invalid HTML.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mathlive"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.104.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.103.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/arnog/mathlive/security/advisories/GHSA-qwj6-q94f-8425"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-29049"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/arnog/mathlive/commit/abc26056fd5e29a99edfa96a0bbe855ea2a8b678"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/arnog/mathlive"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-116", "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-01-21T21:17:52Z",
    "nvd_published_at" : null
  }
}