CVE-2017-5941: Node serialize Code Execution Through IIFE Vulnerability
CRITICALCVE-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.
CVE-2017-5941 at a Glance
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).
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.
npm install node-serialize@Latest secure release
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
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?
Which Node serialize versions are affected?
What version fixes CVE-2017-5941?
Is node-serialize affected?
What is the CVSS score of CVE-2017-5941?
What CWE is associated with CVE-2017-5941?
How can I check npm dependencies for CVE-2017-5941?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}