{"answers":{"affected":"2 open source packages ship an affected version, including mathjs. It affects 1 product.","exploited":"There is no known exploitation of CVE-2026-40897 in the wild and no public exploit code.","fix":"Upgrade mathjs to 15.2.0 or later.","what":"CVE-2026-40897 is a high-severity code injection vulnerability in josdejong mathjs, published on 24 Apr 2026. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2026-40897 and fix it if it is affected.\n\nWhat it is: CVE-2026-40897 is a high-severity code injection vulnerability in josdejong mathjs, published on 24 Apr 2026. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: There is no known exploitation of CVE-2026-40897 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- mathjs (npm): affected from 13.1.1; fixed in 15.2.0\n- mathjs (npm): affected from 13.1.1; fixed in 15.2.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2026-40897/ (Markdown: https://insights.sbomify.com/CVE-2026-40897/index.md)","id":"CVE-2026-40897","markdown":"https://insights.sbomify.com/CVE-2026-40897/index.md","name":"CVE-2026-40897","record":{"aliases":["GHSA-29qv-4j9f-fjw5"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"JavaScript math library","requires_auth":"low_privilege","summary":"Attackers can execute arbitrary JavaScript via the mathjs expression parser if applications allow users to evaluate arbitrary expressions.","user_interaction":"not_required","vuln_class":"code_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"mathjs","vendor":"mathjs"}],"cvss":{"score":8.8,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-917","name":"Improper Neutralization of Special Elements used in an Expression Language Statement"},{"id":"CWE-915","name":"Improperly Controlled Modification of Dynamically-Determined Object Attributes"}],"description":"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 arbitrary expressions using the mathjs expression parser. This vulnerability is fixed in 15.2.0.","ecosystems":["npm"],"exploits":{"exploitdb":0,"first_seen":"2026-05-07","github_poc":2,"max_poc_stars":2,"metasploit":0,"nuclei":0,"refs":[{"date":"2026-05-07T04:27:44Z","kind":"github_poc","ref":"https://github.com/EQSTLab/CVE-2026-40897","stars":2,"title":"Math.js Expression Parser RCE"},{"date":"2026-08-21T04:19:10Z","kind":"github_poc","ref":"https://github.com/yym8538/CVE-2026-40897","stars":1,"title":null}],"tier":"poc_unverified"},"has_fix":true,"headline":"Math.js: Unsafe object property setter in mathjs","id":"CVE-2026-40897","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"npm","product":null,"products":[],"type":"code_injection","year":"2026"},"n_packages":2,"n_references":3,"next":{"headline":"quic-go: HTTP/3 QPACK Trailer Expansion Memory Exhaustion","id":"CVE-2026-40898"},"packages":[{"ecosystem":"npm","fixed":["15.2.0"],"introduced":["13.1.1"],"last_affected":[],"package":"mathjs","purl":null,"source":"GHSA-29qv-4j9f-fjw5"},{"ecosystem":"npm","fixed":["15.2.0"],"introduced":["13.1.1"],"last_affected":[],"package":"mathjs","purl":"pkg:npm/mathjs","source":"GHSA-29qv-4j9f-fjw5"}],"prev":{"headline":"OpenProject has Cross-Project Meeting Agenda Item Injection via Unscoped Section Lookup","id":"CVE-2026-40896"},"products":["mathjs"],"published":"2026-04-24","related":[{"cvss_score":8.8,"headline":"Unsafe array index getter in mathjs","id":"CVE-2026-41139","kev_date_added":null,"published":"2026-05-07"},{"cvss_score":7.3,"headline":"Prototype Pollution","id":"CVE-2020-7743","kev_date_added":null,"published":"2020-10-13"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"},{"class":"open","licence":"CC0","name":"PoC-in-GitHub"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"total"},"state":"PUBLISHED","updated":"2026-07-15","vendors":["josdejong"]},"summary":"Attackers can execute arbitrary JavaScript via the mathjs expression parser if applications allow users to evaluate arbitrary expressions.","url":"https://insights.sbomify.com/CVE-2026-40897/"}