Cyber Resilience

CVE-2026-40897

RCE in Mathjs 13.1.1 – 15.2.0

Published
24 April 2026
Modified
15 July 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.0055 43th percentile
Risk Priority 64 floored blend · peak EPSS

Summary

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

Operationally, exploitation aligns with the MITRE ATT&CK technique Exploit Public-Facing Application (T1190); ranked at the 43th percentile by exploit likelihood (below the median); 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

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.
T1068 Exploitation for Privilege Escalation Privilege Escalation
Adversaries may exploit software vulnerabilities in an attempt to elevate privileges.
T1098 Account Manipulation Persistence
Adversaries may manipulate accounts to maintain and/or elevate access to victim systems.
T1098.001 Additional Cloud Credentials Persistence
Adversaries may add adversary-controlled credentials to a cloud account to maintain persistent access to victim accounts and instances within the environment.
T1098.003 Additional Cloud Roles Persistence
An adversary may add additional roles or permissions to an adversary-controlled cloud account to maintain persistent access to a tenant.
T1098.004 SSH Authorized Keys Persistence
Adversaries may modify the SSH <code>authorized_keys</code> file to maintain persistence on a victim host.
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-12535Shared CWE-915
CVE-2026-55809Shared CWE-915
CVE-2026-58477Shared CWE-915
CVE-2026-21695Shared CWE-915
CVE-2026-34406Shared CWE-915
CVE-2026-59888Shared CWE-915
CVE-2026-15083Shared CWE-915
CVE-2026-48943Shared CWE-915
CVE-2025-24370Shared 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) AI

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) AI

Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→CSF cross-walk (authority under review) — links open the control.

PR.PS-06 mostly match
prevents

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) AI

Derived directly from the weakness types (CWEs) cited in the NVD entry via our AI-authored CWE→ISO cross-walk (authority under review) — links open the control.

prevents

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

finds

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

prevents

Secure development lifecycle requires input validation and object-property whitelisting that directly mitigates mass-assignment risks.

prevents

Application security requirements include explicit rules for allowable object attributes and safe deserialization.

prevents

Secure architecture principles mandate strict control over dynamic object modification and attribute binding.

prevents

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

References