Security Resilience

CVE-2026-40897

RCE in Mathjs 13.1.1 – 15.2.0

Published
24 April 2026
Modified
26 October 2026
Patch / advisory
CVSS Score v3.1 8.8
Click a component to see what it means
Raw vectorCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Score 0.0085 56th percentile
Risk Priority 65 floored blend · peak EPSS

CVSS and EPSS are reproduced from their sources (NVD, FIRST EPSS). EPSS, Forum of Incident Response and Security Teams (FIRST), epss.first.org. Risk Priority is our own derived reading, not an NVD score.

Summary

CVE-2026-40897 is a high-severity Improperly Controlled Modification of Dynamically-Determined Object Attributes (CWE-915) vulnerability in Mathjs. Its CVSS base score is 8.8 (High).

Operationally, exploitation aligns with the MITRE ATT&CK technique Exploitation for Client Execution (T1203); ranked in the top 44% of CVEs by exploit likelihood; it is not currently listed in the CISA KEV catalog.

The strongest mitigations our analysis identified map to AC-3 (Access Enforcement) and AC-6 (Least Privilege) — see the control section below for these in your framework.

Deeper analysis AI-assisted summary

Synthesised by an AI model from the NVD description and linked references — a reading aid, not an authoritative source.

CVE-2026-40897 is a vulnerability in the Math.js library (mathjs), an extensive math library for JavaScript and Node.js. It affects versions from 13.1.1 to before 15.2.0 and stems from the expression parser, which allows execution of arbitrary JavaScript code. Applications are vulnerable if they permit users to evaluate arbitrary expressions using the mathjs parser. The issue is classified as CWE-915 (Improperly Controlled Modification of Dynamically-Determined Expression Evaluators) with a CVSS v3.1 base score of 8.8 (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

An attacker requires low privileges, such as those of an authenticated user, to exploit this over the network with low complexity and no user interaction. By submitting a malicious expression to the parser, they can execute arbitrary JavaScript in the application's context, potentially leading to high impacts on confidentiality, integrity, and availability, such as data theft, modification, or denial of service.

The vulnerability is addressed in mathjs version 15.2.0. Mitigation involves updating to this version or later. Details are available in the GitHub security advisory (GHSA-29qv-4j9f-fjw5), pull request #3656, and fixing commit 513ab2a0e01004af91b31aada68fae8a821326ad.

OWASP Top 10 for Web (2025)

EU & UK References

Vulnerability Data

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…

more

arbitrary expressions using the mathjs expression parser. This vulnerability is fixed in 15.2.0.

CWE(s)

Related Threats

MITRE ATT&CK Enterprise Techniques

MITRE ATT&CK v20.0

T1190 Exploit Public-Facing Application Initial Access
Adversaries may attempt to exploit a weakness in an Internet-facing host or system to initially access a network.
T1203 Exploitation for Client Execution Execution
Adversaries may exploit software vulnerabilities in client applications to execute code.
T1210 Exploitation of Remote Services Lateral Movement
Adversaries may exploit remote services to gain unauthorized access to internal systems once inside of a network.
T1584.004 Server Resource Development
Adversaries may compromise third-party servers that can be used during targeting.
T1056.003 Web Portal Capture Collection
Adversaries may install code on externally facing portals, such as a VPN login page, to capture and transmit credentials of users who attempt to log into the service.
T1068 Exploitation for Privilege Escalation Privilege Escalation
Adversaries may exploit software vulnerabilities in an attempt to elevate privileges.
Derived from this CVE’s CWE(s) via the direct CWE→ATT&CK cross-walk.

CVEs Like This One

CVE-2026-41139Same product: Mathjs Mathjs
CVE-2026-48150Shared CWE-915
CVE-2026-72778Shared CWE-915
CVE-2026-34406Shared CWE-915
CVE-2026-129874Shared CWE-915
CVE-2026-59075Shared CWE-917
CVE-2023-51593Shared CWE-917
CVE-2026-41883Shared CWE-917
CVE-2026-5708Shared CWE-915
CVE-2026-71473Shared CWE-915

Affected Assets

mathjs
mathjs
13.1.1 — 15.2.0

Mitigating Controls

Control response

Prevent
Stop it (NIST 800-53)

—

Detect
Catch it (NIST detect / respond)

—

Harden
Shrink the surface (DISA STIG)

—

Validate
Prove the fix (OWASP ASVS)
  • V1.1.2
  • V1.3.2
  • V1.3.5
  • V4.3.1

Mitigating Controls (NIST 800-53 r5)

Our mappings, made for this CVE.

Enforces authorizations so that only permitted attributes may be modified on an object.

Limits the set of modifiable attributes a subject is authorized to touch.

Validates incoming attribute names and values so that only explicitly allowed fields are accepted for update.

Security engineering principles include requirements for safe construction and sanitization of dynamic statements, structurally preventing expression-language injection at design time.

Mitigating Controls (NIST CSF 2.0)

Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→CSF cross-walk — links open the control.

PR.PS-06 mostly match
blocks

Secure SDLC practices directly require allow-listing of mutable object attributes and input validation to block mass-assignment flaws.

Mitigating Controls (ISO/IEC 27001:2022 Annex A)

Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→ISO cross-walk — links open the control.

finds

Security testing can detect mass-assignment flaws but does not itself prevent them at runtime.

prevents

Secure coding standards explicitly forbid unsafe dynamic attribute assignment and require property allow-lists.

blocks

Information access restriction limits who can modify objects but does not address which attributes may be changed.

prevents

A.8.30 contracts the supplier to apply secure design, coding and testing practices (8.25–8.29), so a well-implemented clause reduces ordinary software weaknesses in delivered code the way those practices do; CWE-915 is a code-level mass-assignment defect reachable by those practices, but the effect depends on the supplier's implementation and the clause's ceiling on this verb is `partial`.

finds

A.8.8's reach is disclosure-based, and mass assignment does surface as CVEs in published products (multiple examples in CWE-915's observed list), so the clause finds that minority; the bulk of mass-assignment instances live in custom first-party code that never receives a CVE, which A.8.8 does not reach.

References