CVE-2017-16031: Socket.io Insecure Randomness Vulnerability
HIGHCVE-2017-16031 is a HIGH (CVSS 7.5) insecure randomness vulnerability (CWE-330: Use of Insufficiently Random Values) affecting Socket.io libraries in the npm ecosystem. The issue involves insecure randomness in socket.io. Remediation is available by upgrading affected packages to version 0.9.7.
CVE-2017-16031 at a Glance
Security Impact
CVSS: 7.5
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:N/A:N).
How to Fix CVE-2017-16031
To remediate this vulnerability, upgrade all affected Socket.io 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 socket.io@0.9.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls socket.io
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2017-16031, inspect your project dependencies using npm:
npm ls socket.io
Analyze the terminal output to locate any version of Socket.io in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.9.7), your application is affected.
Note: The npm ls socket.io 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-330: Use of Insufficiently Random Values, where the product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. In Socket.io, 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-16031 Affected Socket.io Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
socket.io
|
npm |
< 0.9.7
|
0.9.7
|
References
Frequently Asked Questions
What is CVE-2017-16031?
Which Socket.io versions are affected?
What version fixes CVE-2017-16031?
Is socket.io affected?
What is the CVSS score of CVE-2017-16031?
What CWE is associated with CVE-2017-16031?
How can I check npm dependencies for CVE-2017-16031?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qv2v-m59f-v5fw",
"modified" : "2021-09-16T21:04:32Z",
"published" : "2018-11-07T00:29:37Z",
"aliases" : [ "CVE-2017-16031" ],
"summary" : "Insecure randomness in socket.io",
"details" : "Affected versions of `socket.io` depend on `Math.random()` to create socket IDs, and therefore the IDs are predictable. With enough information on prior IDs, an attacker may be able to guess the socket ID and gain access to socket.io servers without authorization.\n\n\n## Recommendation\n\nUpdate to v0.9.7 or later.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "socket.io"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.9.7"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.9.6"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-16031"
}, {
"type" : "WEB",
"url" : "https://github.com/socketio/socket.io/issues/856"
}, {
"type" : "WEB",
"url" : "https://github.com/socketio/socket.io/pull/857"
}, {
"type" : "WEB",
"url" : "https://github.com/socketio/socket.io/commit/67b4eb9abdf111dfa9be4176d1709374a2b4ded8"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-qv2v-m59f-v5fw"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/socketio/socket.io"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/advisories/321"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-330" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T21:52:46Z",
"nvd_published_at" : null
}
}