Quick answers
- Is This vulnerability exploited in the wild?
- No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
- How severe is This vulnerability?
- Low severity, with a CVSS score of 3.1, published 4 June 2019.
- Which products and versions are affected?
- ws (npm) SEMVER:introduced=0.6.0,fixed=1.1.5.
- Is there a fix for This vulnerability?
- Yes. ws (npm): upgrade to 1.1.5 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is This vulnerability attacked?
- It is attacked over the network, in a software library.
- Am I affected?
- Check whether you run ws (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- ws (npm): upgrade to 1.1.5 or later
npm install ws@1.1.5
Technical details
The vulnerability exists in ws's parsing of the Sec-WebSocket-Extensions HTTP header during WebSocket handshake. The parser fails to filter out Object.prototype property names (such as "constructor", "hasOwnProperty", etc.) when extracting extension or parameter names from the header. When these reserved names are used, they can pollute the object prototype or trigger unexpected behavior, causing the server to crash with an unhandled exception. The attack requires only network access—no authentication—and can be triggered with a single malicious WebSocket upgrade request. Versions 0.6.0–1.1.4 and 2.0.0–3.3.0 are affected. The fix (committed in the referenced commits) adds explicit filtering to ignore prototype property names during header parsing. Patches are available in ws 1.1.5 and 3.3.1 or later.
Affected products
- websockets ws 0.6.0 through 1.1.4, 2.0.0 through 3.3.0
Timeline
- 2019-06-04: disclosed
- 2019-06-04: patched: Fix applied in commits c4fe466 and f8fdcd4
References
- https://github.com/websockets/ws/commit/a810bfa44f08c84ff3f43cc71327e9bb5fb273ef
- https://github.com/websockets/ws/commit/c4fe46608acd61fbf7397eadc47378903f95b78a
- https://github.com/websockets/ws/commit/f8fdcd40ac8be7318a6ee41f5ceb7e77c995b407
- https://github.com/websockets/ws
- https://snyk.io/vuln/npm:ws:20171108