# CVE-2017-1001002: math.js arbitrary code execution in typed function

Source: https://junglewise.ai/threats/cve-2017-1001002-math-js-arbitrary-code-execution-in-typed-function  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2017-12-18. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2017-1001002 · Severity: low · CVSS 3 · Published 2017-12-18

math.js is a popular JavaScript library for mathematical computations. A vulnerability allows attackers to execute arbitrary code by crafting a malicious typed function with JavaScript code in the function name, potentially compromising any application using the affected library.

Technologies: [mathjs (npm)](https://junglewise.ai/threats/technologies/mathjs). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2017-1001002 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2017-1001002 being exploited in the wild.

**How severe is CVE-2017-1001002?** Low severity, with a CVSS score of 3, published 18 December 2017.

**Which products and versions are affected?** mathjs (npm) SEMVER:introduced=0,fixed=3.17.0.

**Is there a fix for CVE-2017-1001002?** Yes. mathjs (npm): upgrade to 3.17.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2017-1001002 attacked?** It is attacked over the network.

**Am I affected by CVE-2017-1001002?** Check whether you run mathjs (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- mathjs (npm): upgrade to 3.17.0 or later

  ```sh
  npm install mathjs@3.17.0
  ```


## Technical details

The vulnerability is a code injection issue (CWE-94) in the typed-function component of math.js. An attacker can inject arbitrary JavaScript code through the function name parameter when creating a typed function, which is then executed by the JavaScript engine without proper sanitization. The attack requires the ability to call the typed function creation API, but no network or authentication bypass is needed. An attacker exploiting this can achieve arbitrary code execution with the privileges of the JavaScript runtime environment. The vulnerability was fixed in version 3.17.0.

## Affected products

- math.js math.js before 3.17.0

## Identifiers

- CVE-2017-1001002
- GHSA-vx5c-87qx-cv6c

## Timeline

- 2017-12-18: disclosed: Vulnerability published
- 2017-11-18: patched: Fixed in version 3.17.0

## References

- [https://github.com/josdejong/mathjs/commit/8d2d48d81b3c233fb64eb2ec1d7a9e1cf6a55a90](https://github.com/josdejong/mathjs/commit/8d2d48d81b3c233fb64eb2ec1d7a9e1cf6a55a90)

## Related threats

- [josdejong mathjs arbitrary code execution in expression parser](https://junglewise.ai/threats/cve-2026-41139-josdejong-mathjs-arbitrary-code-execution-in-expression-parser)
- [josdejong mathjs arbitrary code execution in expression parser](https://junglewise.ai/threats/cve-2026-40897-josdejong-mathjs-arbitrary-code-execution-in-expression-parser)
- [mathjs prototype pollution in deepExtend](https://junglewise.ai/threats/cve-2020-7743-mathjs-prototype-pollution-in-deepextend)
- [mathjs arbitrary code execution via unicode property bypass](https://junglewise.ai/threats/cve-2017-1001003-mathjs-arbitrary-code-execution-via-unicode-property-bypass)
