CVE-2026-40897: Unsafe object property setter in mathjs
Impact This security 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. Patches The issue was introduced in mathjs v13.1.1, and patched in mathjs v15.2.0. Workarounds There is no workaround without upgrading to v15.2.0.
Published Apr 16, 2026 · Updated Apr 28, 2026
Affected packages
mathjs
- Ecosystem
- npm
- Affected
- >= 13.1.1, < 15.2.0
- Fixed in
- 15.2.0
- Check
npm ls mathjs
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
This security 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.
Patches
The issue was introduced in mathjs v13.1.1, and patched in mathjs v15.2.0.
Workarounds
There is no workaround without upgrading to v15.2.0.
References
You can find out more via the commit fixing this issue: https://github.com/josdejong/mathjs/commit/513ab2a0e01004af91b31aada68fae8a821326ad (part of PR https://github.com/josdejong/mathjs/pull/3656).
Credited to CykuTW.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
