Vulnerabilities in pkg:npm/node-serialize

PACKAGE
Advisory Identifier: GHSA-q4v7-4rhw-9hqm
Advisory Summary

CVE-2017-5941 is a CRITICAL (CVSS 9.8) code execution through iife vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Node serialize libraries in the npm ecosystem. The issue involves code execution through iife in node-serialize. Remediation is available in the latest vendor maintenance releases.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/node-serialize

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/node-serialize. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-q4v7-4rhw-9hqm CVE-2017-5941 CRITICAL Code Execution through IIFE in node-serialize

CVE-2017-5941 at a Glance

CVE Identifier CVE-2017-5941
GHSA Identifier GHSA-q4v7-4rhw-9hqm
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Node serialize
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2017-5941

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

node-serialize fixed: Latest secure release
npm install node-serialize@Latest secure release
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 node-serialize

How to Check if You Are Affected

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

npm ls node-serialize

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

Note: The npm ls node-serialize 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-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Node serialize, 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

Affected versions of `node-serialize` can be abused to execute arbitrary code via an [immediately invoked function expression](https://en.wikipedia.org/wiki/Immediately-invoked_function_expression) (IIFE) if untrusted user input is passed into `unserialize()`. ## Recommendation There is no direct patch for this issue. The package author has reviewed this advisory, and provided the following recommendation: ``` To avoid the security issues, at least one of the following methods should be taken: 1. Make sure to send serialized strings internally, isolating them from potential hackers. For example, only sending the strings from backend to fronend and always using HTTPS instead of HTTP. 2. Introduce public-key cryptosystems (e.g. RSA) to ensure the strings not being tampered with. ```

CVE-2017-5941 Affected Node serialize Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
node-serialize
npm
≤ 0.0.4

References

Frequently Asked Questions

What is CVE-2017-5941?
CVE-2017-5941 is a security vulnerability in Node serialize involving Code Execution through IIFE in node-serialize under CWE-502: Deserialization of Untrusted Data.
Which Node serialize versions are affected?
Affected versions include releases prior to current release patches across affected packages: node-serialize.
What version fixes CVE-2017-5941?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is node-serialize affected?
Yes, node-serialize is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2017-5941?
CVE-2017-5941 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2017-5941?
CVE-2017-5941 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check npm dependencies for CVE-2017-5941?
Run the dependency tree command: 'npm ls node-serialize'. 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-q4v7-4rhw-9hqm",
  "modified" : "2021-06-23T15:41:17Z",
  "published" : "2018-07-18T18:27:56Z",
  "aliases" : [ "CVE-2017-5941" ],
  "summary" : "Code Execution through IIFE in node-serialize",
  "details" : "Affected versions of `node-serialize` can be abused to execute arbitrary code via an [immediately invoked function expression](https://en.wikipedia.org/wiki/Immediately-invoked_function_expression) (IIFE) if untrusted user input is passed into `unserialize()`.\n\n\n## Recommendation\n\nThere is no direct patch for this issue. The package author has reviewed this advisory, and provided the following recommendation:\n\n```\nTo avoid the security issues, at least one of the following methods should be taken:\n\n1. Make sure to send serialized strings internally, isolating them from potential hackers. For example, only sending the strings from backend to fronend and always using HTTPS instead of HTTP.\n\n2. Introduce public-key cryptosystems (e.g. RSA) to ensure the strings not being tampered with.\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "node-serialize"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.0.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-5941"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/luin/serialize/issues/4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-q4v7-4rhw-9hqm"
  }, {
    "type" : "WEB",
    "url" : "https://opsecx.com/index.php/2017/02/08/exploiting-node-js-deserialization-bug-for-remote-code-execution"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/311"
  }, {
    "type" : "WEB",
    "url" : "http://packetstormsecurity.com/files/161356/Node.JS-Remote-Code-Execution.html"
  }, {
    "type" : "WEB",
    "url" : "http://packetstormsecurity.com/files/163222/Node.JS-Remote-Code-Execution.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.securityfocus.com/bid/96225"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:51:00Z",
    "nvd_published_at" : "2017-02-09T19:59:00Z"
  }
}