Description
Math.js is an extensive math library for JavaScript and Node.js. From 13.1.1 to before 15.2.0, a vulnerability allowed executing arbitrary JavaScript via the expression parser of mathjs. You can be affected when you have an application where users can evaluate arbitrary expressions using the mathjs expression parser. This vulnerability is fixed in 15.2.0.
Published: 2026-04-24
Score: 8.8 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Math.js, an extensive JavaScript and Node.js math library, contains a vulnerability that permits a malicious user to execute arbitrary JavaScript code through the expression parser. The flaw exists in versions between 13.1.1 and before 15.2.0. Exploiting this weakness allows an attacker to run code with the privileges of the hosting process, potentially compromising the entire application or system. The vulnerability is identified as CWE‑915, reflecting the use of unsafe property setters that can be abused to inject code.

Affected Systems

The affected product is Math.js, maintained by the josdejong project. Applications that integrate Math.js and expose the expression parser to remote or unauthenticated users are at risk. All releases from the 13.1.1 release up to, but not including, 15.2.0 are vulnerable. These versions are commonly bundled in Node.js applications, web services, or any Java runtime that imports the Math.js library. Applications using 15.2.0 or newer are no longer affected.

Risk and Exploitability

The CVSS score for this vulnerability is 8.8, indicating a high severity risk. The EPSS score is reported as <1%, suggesting a low probability of widespread exploitation at the moment, but the attack could be highly targeted. The vulnerability is not listed in CISA’s KEV catalog, yet it remains capable of remote code execution if an attacker can supply a crafted expression to the parser. The likely attack vector therefore involves any endpoint or user input that is parsed by Math.js’s expression evaluator. In environments where the library is invoked with data from untrusted sources, an attacker could inject malicious JavaScript, leading to possible compromise of the application, data exfiltration, or denial‑of‑service.

Generated by OpenCVE AI on May 5, 2026 at 01:22 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Math.js to version 15.2.0 or later, which contains the fixed parser.
  • If upgrading is not immediately possible, remove or disable any functionality that exposes the expression parser to untrusted user input; avoid using Math.js’s evaluate() with user‑supplied content.
  • Implement input validation or sandboxing around the expression evaluation to restrict execution to safe arithmetic expressions only; consider using a whitelist approach or a dedicated safe evaluation library.

Generated by OpenCVE AI on May 5, 2026 at 01:22 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-29qv-4j9f-fjw5 Unsafe object property setter in mathjs
History

Tue, 05 May 2026 00:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-917
References
Metrics threat_severity

None

threat_severity

Important


Tue, 28 Apr 2026 09:45:00 +0000

Type Values Removed Values Added
First Time appeared Josdejong
Josdejong mathjs
Vendors & Products Josdejong
Josdejong mathjs

Mon, 27 Apr 2026 15:00:00 +0000

Type Values Removed Values Added
First Time appeared Mathjs
Mathjs mathjs
CPEs cpe:2.3:a:mathjs:mathjs:*:*:*:*:*:node.js:*:*
Vendors & Products Mathjs
Mathjs mathjs

Fri, 24 Apr 2026 18:15:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Fri, 24 Apr 2026 17:15:00 +0000

Type Values Removed Values Added
Description Math.js is an extensive math library for JavaScript and Node.js. From 13.1.1 to before 15.2.0, a vulnerability allowed executing arbitrary JavaScript via the expression parser of mathjs. You can be affected when you have an application where users can evaluate arbitrary expressions using the mathjs expression parser. This vulnerability is fixed in 15.2.0.
Title Math.js: Unsafe object property setter in mathjs
Weaknesses CWE-915
References
Metrics cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-04-24T17:44:59.520Z

Reserved: 2026-04-15T16:37:22.766Z

Link: CVE-2026-40897

cve-icon Vulnrichment

Updated: 2026-04-24T17:44:56.265Z

cve-icon NVD

Status : Analyzed

Published: 2026-04-24T17:16:20.783

Modified: 2026-04-27T14:47:56.323

Link: CVE-2026-40897

cve-icon Redhat

Severity : Important

Publid Date: 2026-04-24T16:48:34Z

Links: CVE-2026-40897 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-05-05T01:30:12Z

Weaknesses