CVE-2017-5954: Serialize to js Code Execution Through IIFE Vulnerability
CRITICALCVE-2017-5954 is a CRITICAL (CVSS 9.8) code execution through iife vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Serialize to js libraries in the npm ecosystem. The issue involves code execution through iife in serialize-to-js. Remediation is available by upgrading affected packages to version 1.0.0.
CVE-2017-5954 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.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2017-5954
To remediate this vulnerability, upgrade all affected Serialize to js 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 serialize-to-js@1.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls serialize-to-js
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2017-5954, inspect your project dependencies using npm:
npm ls serialize-to-js
Analyze the terminal output to locate any version of Serialize to js in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.0), your application is affected.
Note: The npm ls serialize-to-js 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 Serialize to js, 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-5954 Affected Serialize to js Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
serialize-to-js
|
npm |
< 1.0.0
|
1.0.0
|
References
Frequently Asked Questions
What is CVE-2017-5954?
Which Serialize to js versions are affected?
What version fixes CVE-2017-5954?
Is serialize-to-js affected?
What is the CVSS score of CVE-2017-5954?
What CWE is associated with CVE-2017-5954?
How can I check npm dependencies for CVE-2017-5954?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mm62-wxc8-cf7m",
"modified" : "2023-09-13T19:43:49Z",
"published" : "2018-07-18T18:27:41Z",
"aliases" : [ "CVE-2017-5954" ],
"summary" : "Code Execution Through IIFE in serialize-to-js",
"details" : "Affected versions of `serialize-to-js` may be vulnerable to arbitrary code execution through an Immediately Invoked Function Expression (IIFE). \n\n## Proof of Concept\n```js\nvar payload = \"{e: (function(){ eval('console.log(`exploited`)') })() }\"\nvar serialize = require('serialize-to-js');\nserialize.deserialize(payload);\n```\n\n\n## Recommendation\n\nUpdate to version 1.0.0, or later, and review [this disclaimer](https://www.npmjs.com/package/serialize-to-js#deserialize) from the author.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "serialize-to-js"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-5954"
}, {
"type" : "WEB",
"url" : "https://github.com/commenthol/serialize-to-js/issues/1"
}, {
"type" : "WEB",
"url" : "https://github.com/commenthol/serialize-to-js/commit/1cd433960e5b9db4c0b537afb28366198a319429"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-mm62-wxc8-cf7m"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/commenthol/serialize-to-js"
}, {
"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/313"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/serialize-to-js#deserialize"
}, {
"type" : "WEB",
"url" : "http://www.securityfocus.com/bid/96223"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-502" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T21:46:35Z",
"nvd_published_at" : null
}
}