CVE-2017-1001004: Typed function Arbitrary JavaScript Execution Vulnerability

HIGH
Advisory Identifier: GHSA-3qh4-r86r-grvm
CWE-94
Published
Advisory Summary

CVE-2017-1001004 is a HIGH arbitrary javascript execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Typed function libraries in the npm ecosystem. The issue involves arbitrary javascript execution in typed-function. Remediation is available by upgrading affected packages to version 0.10.6.

CVE-2017-1001004 at a Glance

CVE Identifier CVE-2017-1001004
GHSA Identifier GHSA-3qh4-r86r-grvm
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Typed function
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2017-1001004

To remediate this vulnerability, upgrade all affected Typed function dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

typed-function fixed: 0.10.6
npm install typed-function@0.10.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls typed-function

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2017-1001004, inspect your project dependencies using npm:

npm ls typed-function

Analyze the terminal output to locate any version of Typed function in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.10.6), your application is affected.

Note: The npm ls typed-function command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Typed function, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Versions of `typed-function` prior to 0.10.6 are vulnerable to Arbitrary JavaScript Execution. Function names are not properly sanitized and may allow an attacker to execute arbitrary code. ## Recommendation Upgrade to version 0.10.6 or later.

CVE-2017-1001004 Affected Typed function Versions

1 component(s)
Fixed Versions:
0.10.6
Product / Package Ecosystem Affected Versions Fixed Version
typed-function
npm
< 0.10.6
0.10.6

References

Frequently Asked Questions

What is CVE-2017-1001004?
CVE-2017-1001004 is a security vulnerability in Typed function involving Arbitrary JavaScript Execution in typed-function under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Typed function versions are affected?
Affected versions include releases prior to 0.10.6 across affected packages: typed-function.
What version fixes CVE-2017-1001004?
Upgrading to 0.10.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is typed-function affected?
Yes, typed-function is affected in releases prior to 0.10.6. Upgrade your dependency to 0.10.6 or later.
What CWE is associated with CVE-2017-1001004?
CVE-2017-1001004 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check npm dependencies for CVE-2017-1001004?
Run the dependency tree command: 'npm ls typed-function'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3qh4-r86r-grvm",
  "modified" : "2020-08-31T18:36:57Z",
  "published" : "2020-09-02T18:24:39Z",
  "aliases" : [ "CVE-2017-1001004" ],
  "summary" : "Arbitrary JavaScript Execution in typed-function",
  "details" : "Versions of `typed-function` prior to 0.10.6 are vulnerable to Arbitrary JavaScript Execution. Function names are not properly sanitized and may allow an attacker to execute arbitrary code.\n\n\n## Recommendation\n\nUpgrade to version 0.10.6 or later.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "typed-function"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.10.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-1001004"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/josdejong/typed-function/commit/6478ef4f2c3f3c2d9f2c820e2db4b4ba3425e6fe"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/josdejong/typed-function/commit/6478ef4f2c3f3c2d9f2c820e2db4b4ba3425e6fe?diff=split#diff-9e1f22c2954a38db1fdf444dbc74e0a8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/josdejong/typed-function/blob/master/HISTORY.md#2017-11-18-version-0106"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-TYPEDFUNCTION-174139"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/819"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:36:57Z",
    "nvd_published_at" : null
  }
}