A Leader in the 2026 Gartner® Magic Quadrant™ for Endpoint Protection. Six years running.Six years. Gartner® Magic Quadrant™ Leader.Find Out Why
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-40897

CVE-2026-40897: Math.js Expression Parser RCE Vulnerability

CVE-2026-40897 is a remote code execution flaw in the Math.js expression parser that enables arbitrary JavaScript execution. This post covers the technical details, affected versions 13.1.1 to 15.2.0, and mitigation steps.

Published: April 30, 2026

CVE-2026-40897 Overview

A critical arbitrary code execution vulnerability has been identified in Math.js, an extensive math library for JavaScript and Node.js. The vulnerability exists in the expression parser component, allowing attackers to execute arbitrary JavaScript code when user-supplied expressions are evaluated. Applications that permit users to evaluate arbitrary expressions using the mathjs expression parser are at risk of complete system compromise.

Critical Impact

Attackers can achieve arbitrary JavaScript code execution through the mathjs expression parser, potentially leading to full application compromise, data theft, and server-side code execution in Node.js environments.

Affected Products

  • Math.js versions 13.1.1 through 15.1.x (prior to 15.2.0)
  • Node.js applications using vulnerable mathjs expression parser
  • JavaScript applications integrating mathjs for user-provided expression evaluation

Discovery Timeline

  • 2026-04-24 - CVE CVE-2026-40897 published to NVD
  • 2026-04-27 - Last updated in NVD database

Technical Details for CVE-2026-40897

Vulnerability Analysis

This vulnerability (CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes) allows attackers to bypass security controls in the mathjs expression parser. The flaw exists in the internal setSafeProperty function, which failed to properly restrict property assignments on objects. By crafting malicious expressions, an attacker could manipulate object properties beyond intended boundaries, ultimately achieving arbitrary JavaScript code execution.

The vulnerability is particularly dangerous in applications where untrusted users can submit mathematical expressions for evaluation. Since mathjs is commonly used in educational platforms, scientific calculators, and data processing applications, the attack surface is significant across the JavaScript and Node.js ecosystems.

Root Cause

The root cause lies in the insufficient validation within the setSafeProperty utility function located in src/utils/map.js. The function was designed to prevent unsafe property modifications but contained a flaw that allowed attackers to set properties beyond the intended safe boundaries. The security patch addresses this by replacing isSafeProperty with the more restrictive isSafeObjectProperty check, ensuring only explicitly permitted object properties can be modified during expression evaluation.

Attack Vector

The attack is network-accessible and requires low privileges to execute. An attacker with the ability to submit expressions to a vulnerable mathjs parser can craft specially formatted input that escapes the expression sandbox. This allows direct JavaScript execution within the context of the application, bypassing mathjs's built-in security controls.

In web applications, this could be exploited through form inputs, API endpoints, or WebSocket messages that accept mathematical expressions. In Node.js server environments, successful exploitation could lead to server-side code execution, file system access, and complete system compromise.

javascript
-import { getSafeProperty, isSafeProperty, setSafeProperty } from './customs.js'
+import {
+  getSafeProperty,
+  isSafeObjectProperty,
+  setSafeProperty
+} from './customs.js'
 import { isMap, isObject } from './is.js'
 
 /**

Source: GitHub Commit Update

Detection Methods for CVE-2026-40897

Indicators of Compromise

  • Unusual or malformed mathematical expressions in application logs containing JavaScript syntax or object manipulation patterns
  • Unexpected server-side process spawning or file system access following expression evaluation requests
  • Application errors or exceptions originating from the mathjs expression parser with stack traces indicating property manipulation

Detection Strategies

  • Implement input validation logging to capture and analyze all expressions submitted to the mathjs parser
  • Monitor application behavior for anomalous JavaScript execution patterns following expression evaluation
  • Deploy runtime application self-protection (RASP) to detect and block code injection attempts within expression parsing contexts
  • Review dependency manifests to identify mathjs versions between 13.1.1 and 15.1.x

Monitoring Recommendations

  • Enable detailed logging for all mathjs evaluate() function calls with input sanitization alerts
  • Configure intrusion detection systems to flag HTTP requests containing potential JavaScript injection patterns in mathematical expression fields
  • Implement anomaly detection for unusual Node.js process behavior indicative of sandbox escape

How to Mitigate CVE-2026-40897

Immediate Actions Required

  • Upgrade mathjs to version 15.2.0 or later immediately
  • Audit all application entry points where user-supplied expressions are passed to the mathjs parser
  • Implement additional input validation as a defense-in-depth measure while scheduling upgrades
  • Review application logs for any historical exploitation attempts

Patch Information

The vulnerability is fixed in mathjs version 15.2.0. The patch, available via GitHub Commit 513ab2a0e01004af91b31aada68fae8a821326ad, improves the internal setSafeProperty function to properly restrict property modifications. The fix replaces the isSafeProperty validation with the more secure isSafeObjectProperty check, preventing attackers from manipulating object attributes outside of intended boundaries. Full details are available in the GitHub Security Advisory GHSA-29qv-4j9f-fjw5.

Workarounds

  • Restrict or disable user-supplied expression evaluation until the patch can be applied
  • Implement strict allowlisting of mathematical functions and operators that users can access
  • Run mathjs expression evaluation in an isolated sandbox environment with restricted permissions
  • Consider using mathjs in "limited" mode to reduce the attack surface of the expression parser
bash
# Update mathjs to the patched version
npm update mathjs@15.2.0

# Verify installed version
npm list mathjs

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechMathjs

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability0.09%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-915
  • Technical References
  • GitHub Pull Request 3656
  • Vendor Resources
  • GitHub Commit Update

  • GitHub Security Advisory GHSA-29qv-4j9f-fjw5
  • Related CVEs
  • CVE-2026-41139: Math.js Expression Parser RCE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English