Junglewise Threat Intelligence

CVE-2026-41139: josdejong mathjs arbitrary code execution in expression parser

CVE-2026-41139 · Severity: high · CVSS 8.8 · Published 2026-05-07

Technologies: mathjs (npm), Jos de Jong Math.Js. Vendors: npm, Jos de Jong.

Executive brief

Math.js, a popular mathematics library for JavaScript and Node.js, contains a vulnerability in its expression parser. An attacker can exploit this to execute unauthorized code on the system where the library is running. This could lead to full system compromise, data theft, or service disruption.

Technical details

A code injection vulnerability exists in Math.js versions 13.1.0 to 15.2.0 due to improper validation in the expression parser. The flaw involves CWE-915 (Improperly Controlled Modification of Dynamically-Determined Object Attributes) and CWE-94 (Improper Control of Generation of Code). Specifically, the internal `setSafeProperty` function failed to sufficiently restrict property modifications on arrays, and the `.get()` method did not properly validate that the `index` parameter was an array. An attacker with the ability to provide expressions to the parser can achieve arbitrary JavaScript execution. The issue is patched in version 15.2.0.

Affected products

  • josdejong mathjs >= 13.1.0, < 15.2.0

Timeline

  • 2026-04-07: patched: Fixes committed to repository
  • 2026-05-07: advisory: CVE published

References

Related threats