Last tested: 20 Feb, 2018

node-inspector vulnerabilities

Web Inspector based nodeJS debugger

View on npm

node-inspector (latest)

Published 13 Feb, 2018

Known vulnerabilities2
Vulnerable paths18
Dependencies277

Prototype Pollution

low severity

Detailed paths

  • Introduced through: node-inspector@1.1.2 > v8-debug@1.0.1 > node-pre-gyp@0.6.39 > hawk@3.1.3 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-profiler@5.7.0 > node-pre-gyp@0.6.39 > hawk@3.1.3 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-debug@1.0.1 > node-pre-gyp@0.6.39 > hawk@3.1.3 > boom@2.10.1 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-profiler@5.7.0 > node-pre-gyp@0.6.39 > hawk@3.1.3 > boom@2.10.1 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-debug@1.0.1 > node-pre-gyp@0.6.39 > hawk@3.1.3 > cryptiles@2.0.5 > boom@2.10.1 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-profiler@5.7.0 > node-pre-gyp@0.6.39 > hawk@3.1.3 > cryptiles@2.0.5 > boom@2.10.1 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-debug@1.0.1 > node-pre-gyp@0.6.39 > request@2.81.0 > hawk@3.1.3 > cryptiles@2.0.5 > boom@2.10.1 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-profiler@5.7.0 > node-pre-gyp@0.6.39 > request@2.81.0 > hawk@3.1.3 > cryptiles@2.0.5 > boom@2.10.1 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-debug@1.0.1 > node-pre-gyp@0.6.39 > request@2.81.0 > hawk@3.1.3 > boom@2.10.1 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-profiler@5.7.0 > node-pre-gyp@0.6.39 > request@2.81.0 > hawk@3.1.3 > boom@2.10.1 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-debug@1.0.1 > node-pre-gyp@0.6.39 > hawk@3.1.3 > sntp@1.0.9 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-profiler@5.7.0 > node-pre-gyp@0.6.39 > hawk@3.1.3 > sntp@1.0.9 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-debug@1.0.1 > node-pre-gyp@0.6.39 > request@2.81.0 > hawk@3.1.3 > sntp@1.0.9 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-profiler@5.7.0 > node-pre-gyp@0.6.39 > request@2.81.0 > hawk@3.1.3 > sntp@1.0.9 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-debug@1.0.1 > node-pre-gyp@0.6.39 > request@2.81.0 > hawk@3.1.3 > hoek@2.16.3
  • Introduced through: node-inspector@1.1.2 > v8-profiler@5.7.0 > node-pre-gyp@0.6.39 > request@2.81.0 > hawk@3.1.3 > hoek@2.16.3

Overview

hoek is a Utility methods for the hapi ecosystem.

Affected versions of this package are vulnerable to Prototype Pollution. The utilities function allow modification of the Object prototype. If an attacker can control part of the structure passed to this function, they could add or modify an existing property.

PoC by Olivier Arteau (HoLyVieR)

var Hoek = require('hoek');
var malicious_payload = '{"__proto__":{"oops":"It works !"}}';

var a = {};
console.log("Before : " + a.oops);
Hoek.merge({}, JSON.parse(malicious_payload));
console.log("After : " + a.oops);

Remediation

Upgrade hoek to versions 4.2.1, 5.0.3 or higher.

References

Prototype Pollution

low severity

Detailed paths

  • Introduced through: node-inspector@1.1.2 > biased-opener@0.2.8 > browser-launcher2@0.4.6 > lodash@2.4.2
  • Introduced through: node-inspector@1.1.2 > biased-opener@0.2.8 > browser-launcher2@0.4.6 > plist@1.2.0 > xmlbuilder@4.0.0 > lodash@3.10.1

Overview

lodash is a javaScript utility library delivering modularity, performance & extras.

Affected versions of this package are vulnerable to Prototype Pollution. The utilities function allow modification of the Object prototype. If an attacker can control part of the structure passed to this function, they could add or modify an existing property.

PoC by Olivier Arteau (HoLyVieR)

var _= require('lodash');
var malicious_payload = '{"__proto__":{"oops":"It works !"}}';

var a = {};
console.log("Before : " + a.oops);
_.merge({}, JSON.parse(malicious_payload));
console.log("After : " + a.oops);

Remediation

Upgrade lodash to version 4.17.5 or higher.

References

Vulnerable versions of node-inspector

Fixed in 0.12.8

Denial of Service (DoS)

high severity

Detailed paths

  • Introduced through: karma@0.12.7 > socket.io@0.9.19 > socket.io-client@0.9.16 > ws@0.4.32
  • Introduced through: node-inspector@0.12.7 > ws@0.8.1

Overview

ws is a simple to use websocket client, server and console for node.js.

Affected versions of the package are vulnerable to Denial of Service (DoS) attacks. A specially crafted value of the Sec-WebSocket-Extensions header that used Object.prototype property names as extension or parameter names could be used to make a ws server crash.

PoC:

const WebSocket = require('ws');
const net = require('net');

const wss = new WebSocket.Server({ port: 3000 }, function () {
  const payload = 'constructor';  // or ',;constructor'

  const request = [
    'GET / HTTP/1.1',
    'Connection: Upgrade',
    'Sec-WebSocket-Key: test',
    'Sec-WebSocket-Version: 8',
    `Sec-WebSocket-Extensions: ${payload}`,
    'Upgrade: websocket',
    '\r\n'
  ].join('\r\n');

  const socket = net.connect(3000, function () {
    socket.resume();
    socket.write(request);
  });
});

Remediation

Upgrade ws to version 1.1.5, 3.3.1 or higher.

References

Remote Memory Exposure

medium severity

Detailed paths

  • Introduced through: karma@0.12.7 > socket.io@0.9.19 > socket.io-client@0.9.16 > ws@0.4.32
  • Introduced through: node-inspector@0.12.7 > ws@0.8.1

Overview

ws is a simple to use websocket client, server and console for node.js. Affected versions of the package are vulnerable to Uninitialized Memory Exposure.

A client side memory disclosure vulnerability exists in ping functionality of the ws service. When a client sends a ping request and provides an integer value as ping data, it will result in leaking an uninitialized memory buffer.

This is a result of unobstructed use of the Buffer constructor, whose insecure default constructor increases the odds of memory leakage.

Details

Constructing a Buffer class with integer N creates a Buffer of length N with raw (not "zero-ed") memory.

In the following example, the first call would allocate 100 bytes of memory, while the second example will allocate the memory needed for the string "100":

// uninitialized Buffer of length 100
x = new Buffer(100);
// initialized Buffer with value of '100'
x = new Buffer('100');

This would allocate 100 bytes of memory in the first example and just 3 bytes with 100 as value in the second example.

ws's ping function uses the default Buffer constructor as-is, making it easy to append uninitialized memory to an existing list. If the value of the buffer list is exposed to users, it may expose raw memory, potentially holding secrets, private data and code.

Proof of Concept:

var ws = require('ws')

var server = new ws.Server({ port: 9000 })
var client = new ws('ws://localhost:9000')

client.on('open', function () {
  console.log('open')
  client.ping(50) // this makes the client allocate an uninitialized buffer of 50 bytes and send it to the server

  client.on('pong', function (data) {
    console.log('got pong')
    console.log(data)
  })
})

You can read more about the insecure Buffer behavior on our blog.

Similar vulnerabilities were discovered in request, mongoose, ws and sequelize.

References

Denial of Service (DoS)

high severity

Detailed paths

  • Introduced through: karma@0.12.7 > socket.io@0.9.19 > socket.io-client@0.9.16 > ws@0.4.32
  • Introduced through: node-inspector@0.12.7 > ws@0.8.1

Overview

The ws package does not limit the size of an incoming payload before it is processed by default. As a result, a very large payload (over 256MB in size) can lead to a failed allocation and crash the node process - enabling a Denial of Service attack.

While 256MB may seem excessive, note that the attack is likely to be sent from another server, not an end-user computer, using data-center connection speeds. In those speeds, a payload of this size can be transmitted in seconds.

Remediation

Update to version 1.1.1 or greater, which sets a default maxPayload of 100MB. If you cannot upgrade, apply a Snyk patch, or provide ws with options setting the maxPayload to an appropriate size that is smaller than 256MB.

References

Insecure Randomness

medium severity

Detailed paths

  • Introduced through: karma@0.12.7 > socket.io@0.9.19 > socket.io-client@0.9.16 > ws@0.4.32
  • Introduced through: node-inspector@0.12.7 > ws@0.8.1

Overview

ws is a simple to use websocket client, server and console for node.js.

Affected versions of the package use the cryptographically insecure Math.random() which can produce predictable values and should not be used in security-sensitive context.

Details

Computers are deterministic machines, and as such are unable to produce true randomness. Pseudo-Random Number Generators (PRNGs) approximate randomness algorithmically, starting with a seed from which subsequent values are calculated.

There are two types of PRNGs: statistical and cryptographic. Statistical PRNGs provide useful statistical properties, but their output is highly predictable and forms an easy to reproduce numeric stream that is unsuitable for use in cases where security depends on generated values being unpredictable. Cryptographic PRNGs address this problem by generating output that is more difficult to predict. For a value to be cryptographically secure, it must be impossible or highly improbable for an attacker to distinguish between it and a truly random value. In general, if a PRNG algorithm is not advertised as being cryptographically secure, then it is probably a statistical PRNG and should not be used in security-sensitive contexts.

You can read more about node's insecure Math.random() in Mike Malone's post.

Remediation

Upgrade ws to version 1.1.2 or higher.

References

Fixed in 0.10.1

Regular Expression Denial of Service (ReDoS)

low severity

Detailed paths

  • Introduced through: pm2@0.10.0 > debug@1.0.5
  • Introduced through: node-inspector@0.10.0 > debug@1.0.5

Overview

debug is a JavaScript debugging utility modelled after Node.js core's debugging technique..

debug uses printf-style formatting. Affected versions of this package are vulnerable to Regular expression Denial of Service (ReDoS) attacks via the the %o formatter (Pretty-print an Object all on a single line). It used a regular expression (/\s*\n\s*/g) in order to strip whitespaces and replace newlines with spaces, in order to join the data into a single line. This can cause a very low impact of about 2 seconds matching time for data 50k characters long.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Many Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size), allowing an attacker to exploit this and can cause the program to enter these extreme situations by using a specially crafted input and cause the service to excessively consume CPU, resulting in a Denial of Service.

You can read more about Regular Expression Denial of Service (ReDoS) on our blog.

Remediation

Upgrade debug to version 2.6.9, 3.1.0 or higher.

References

Regular Expression Denial of Service (DoS)

high severity

Detailed paths

  • Introduced through: forever@0.10.0 > forever-monitor@1.0.1 > minimatch@0.0.5
  • Introduced through: bower@0.10.0 > glob@3.1.21 > minimatch@0.2.14
  • Introduced through: bower@0.10.0 > read-package-json@0.1.13 > glob@3.1.21 > minimatch@0.2.14
  • Introduced through: karma@0.10.0 > minimatch@0.2.14
  • Introduced through: karma@0.10.0 > glob@3.1.21 > minimatch@0.2.14
  • Introduced through: node-inspector@0.10.0 > glob@4.5.3 > minimatch@2.0.10

Overview

minimatch is a minimalistic matching library used for converting glob expressions into JavaScript RegExp objects. Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) attacks.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Many Regular Expression implementations may reach edge cases that causes them to work very slowly (exponentially related to input size), allowing an attacker to exploit this and can cause the program to enter these extreme situations by using a specially crafted input and cause the service to excessively consume CPU, resulting in a Denial of Service.

An attacker can provide a long value to the minimatch function, which nearly matches the pattern being matched. This will cause the regular expression matching to take a long time, all the while occupying the event loop and preventing it from processing other requests and making the server unavailable (a Denial of Service attack).

You can read more about Regular Expression Denial of Service (ReDoS) on our blog.

Remediation

Upgrade minimatch to version 3.0.2 or greater.

References

Regular Expression Denial of Service (DoS)

medium severity

Detailed paths

  • Introduced through: bower@0.10.0 > semver@2.0.11
  • Introduced through: bower@0.10.0 > read-package-json@0.1.13 > semver@1.1.4
  • Introduced through: bower@0.10.0 > update-notifier@0.1.10 > semver@2.3.2
  • Introduced through: node-inspector@0.10.0 > semver@3.0.1

Overview

The semver module uses regular expressions when parsing a version string. For a carefully crafted input, the time it takes to process these regular expressions is not linear to the length of the input. Since the semver module did not enforce a limit on the version string length, an attacker could provide a long string that would take up a large amount of resources, potentially taking a server down. This issue therefore enables a potential Denial of Service attack. This is a slightly differnt variant of a typical Regular Expression Denial of Service (ReDoS) vulnerability.

Remediation

Update to a version 4.3.2 or greater. From the issue description [2]: "Package version can no longer be more than 256 characters long. This prevents a situation in which parsing the version number can use exponentially more time and memory to parse, leading to a potential denial of service."

References

Fixed in 0.8.0

Root Path Disclosure

low severity
  • Vulnerable module: serve-static
  • Introduced through: express@4.0.0

Detailed paths

  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > serve-static@1.0.1

Overview:

root path disclosure vulnerability in express.static, res.sendfile, and res.sendFile

Original description taken from the Node Security Project

Recommendations:

  • Update to version 1.8.1 or greater.

References:

Denial of Service (Memory Exhaustion)

high severity

Detailed paths

  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > qs@0.6.6
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > qs@0.6.6

Overview

qs is a querystring parser that supports nesting and arrays, with a depth limit.

During parsing, the qs module may create a sparse area (an array where no elements are filled), and grow that array to the necessary size based on the indices used on it. An attacker can specify a high index value in a query string, thus making the server allocate a respectively big array. Truly large values can cause the server to run out of memory and cause it to crash - thus enabling a Denial-of-Service attack.

Remediation

Upgrade qs to version 1.0.0 or greater. In these versions, qs introduced a low limit on the index value, preventing such an attack

References

Regular Expression Denial of Service (DoS)

high severity

Detailed paths

  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > negotiator@0.3.0
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > accepts@1.0.0 > negotiator@0.3.0

Overview

negotiator is an HTTP content negotiator for Node.js. Versions prior to 0.6.1 are vulnerable to Regular expression Denial of Service (ReDoS) attack when parsing "Accept-Language" http header.

An attacker can provide a long value in the Accept-Language header, which nearly matches the pattern being matched. This will cause the regular expression matching to take a long time, all the while occupying the thread and preventing it from processing other requests. By repeatedly sending multiple such requests, the attacker can make the server unavailable (a Denial of Service attack).

Details

The Regular expression Denial of Service (ReDoS) is a Denial of Service attack, that exploits the fact that most Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size). An attacker can then cause a program using a Regular Expression to enter these extreme situations and then hang for a very long time. [1]

Remediation

Upgrade negotiator to to version 0.6.1 or greater.

References

Cross-site Scripting (XSS)

medium severity

Detailed paths

  • Introduced through: node-inspector@0.7.5 > express@4.0.0

Overview

express is a minimalist web framework.

Affected versions of this package do not enforce the user's browser to set a specific charset in the content-type header while displaying 400 level response messages. This could be used by remote attackers to perform a cross-site scripting attack, by using non-standard encodings like UTF-7.

Recommendations

Update express to 3.11.0, 4.5.0 or higher.

References

Denial of Service (Event Loop Blocking)

medium severity

Detailed paths

  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > qs@0.6.6
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > qs@0.6.6

Overview

qs is a querystring parser that supports nesting and arrays, with a depth limit.

When parsing a string representing a deeply nested object, qs will block the event loop for long periods of time. Such a delay may hold up the server's resources, keeping it from processing other requests in the meantime, thus enabling a Denial-of-Service attack.

Remediation

Update qs to version 1.0.0 or higher. In these versions, qs enforces a max object depth (along with other limits), limiting the event loop length and thus preventing such an attack.

References

Regular Expression Denial of Service (ReDoS)

high severity

Detailed paths

  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > fresh@0.2.0
  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > send@0.1.4 > fresh@0.2.0
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > fresh@0.2.2
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > send@0.2.0 > fresh@0.2.4
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > serve-static@1.0.1 > send@0.1.4 > fresh@0.2.0

Overview

fresh is HTTP response freshness testing.

Affected versions of this package are vulnerable to Regular expression Denial of Service (ReDoS) attacks. A Regular Expression (/ *, */) was used for parsing HTTP headers and take about 2 seconds matching time for 50k characters.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Many Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size), allowing an attacker to exploit this and can cause the program to enter these extreme situations by using a specially crafted input and cause the service to excessively consume CPU, resulting in a Denial of Service.

You can read more about Regular Expression Denial of Service (ReDoS) on our blog.

Remediation

Upgrade fresh to version 0.5.2 or higher.

References

Regular Expression Denial of Service (ReDoS)

low severity

Detailed paths

  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > send@0.1.4 > mime@1.2.11
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > accepts@1.0.0 > mime@1.2.11
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > type-is@1.0.0 > mime@1.2.11
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > send@0.2.0 > mime@1.2.11
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > serve-static@1.0.1 > send@0.1.4 > mime@1.2.11

Overview

mime is a comprehensive, compact MIME type module.

Affected versions of this package are vulnerable to Regular expression Denial of Service (ReDoS). It uses regex the following regex /.*[\.\/\\]/ in its lookup, which can cause a slowdown of 2 seconds for 50k characters.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Many Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size), allowing an attacker to exploit this and can cause the program to enter these extreme situations by using a specially crafted input and cause the service to excessively consume CPU, resulting in a Denial of Service.

You can read more about Regular Expression Denial of Service (ReDoS) on our blog.

Remediation

Upgrade mime to versions 1.4.1, 2.0.3 or higher.

References

Directory Traversal

medium severity

Detailed paths

  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > send@0.1.4
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > send@0.2.0
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > serve-static@1.0.1 > send@0.1.4

Overview

When relying on the root option to restrict file access it may be possible for an application consumer to escape out of the restricted directory and access files in a similarly named directory. For example, static(_dirname + '/public') would allow access to _dirname + '/public-restricted'.

Source: Node Security Project

Remediation

Upgrade to a version greater than or equal to 0.8.4.

References

Non-Constant Time String Comparison

medium severity

Detailed paths

  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > cookie-signature@1.0.1
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > cookie-signature@1.0.3

Overview

'cookie-signature' is a library for signing cookies.

Versions before 1.0.4 of the library use the built-in string comparison mechanism, ===, and not a time constant string comparison. As a result, the comparison will fail faster when the first characters in the token are incorrect. An attacker can use this difference to perform a timing attack, essentially allowing them to guess the secret one character at a time.

You can read more about timing attacks in Node.js on the Snyk blog: https://snyk.io/blog/node-js-timing-attack-ccc-ctf/

Remediation

Upgrade to 1.0.4 or greater.

References

Root Path Disclosure

medium severity

Detailed paths

  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > send@0.1.4
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > send@0.2.0
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > serve-static@1.0.1 > send@0.1.4

Overview

Send is a library for streaming files from the file system as an http response. It supports partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework.

A root path disclosure vulnerability exists in send versions prior to 0.11.1.

Remediation

Upgrade send to version 0.11.1. or greater.

If a direct dependency update is not possible, use snyk wizard to patch this vulnerability.

References

Open Redirect

low severity
  • Vulnerable module: serve-static
  • Introduced through: express@4.0.0

Detailed paths

  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > serve-static@1.0.1

Overview

When using serve-static middleware version < 1.7.2 and it's configured to mount at the root, it creates an open redirect on the site.

Source: Node Security Project

Details

For example:

If a user visits http://example.com//www.google.com/%2e%2e they will be redirected to //www.google.com/%2e%2e, which some browsers interpret as http://www.google.com/%2e%2e.

Remediation

  • Update to version 1.7.2 or greater (or 1.6.5 if sticking to the 1.6.x line).
  • Disable redirects if not using the feature with 'redirect: false' option and cannot upgrade.

References

Prototype Override Protection Bypass

high severity

Detailed paths

  • Introduced through: http-server@0.7.5 > union@0.4.6 > qs@2.3.3
  • Introduced through: browser-sync@0.7.5 > connect@2.13.1 > qs@0.6.6
  • Introduced through: node-inspector@0.7.5 > express@4.0.0 > qs@0.6.6

Overview

qs is a querystring parser that supports nesting and arrays, with a depth limit.

By default qs protects against attacks that attempt to overwrite an object's existing prototype properties, such as toString(), hasOwnProperty(),etc.

From qs documentation:

By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use plainObjects as mentioned above, or set allowPrototypes to true which will allow user input to overwrite those properties. WARNING It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option.

Overwriting these properties can impact application logic, potentially allowing attackers to work around security controls, modify data, make the application unstable and more.

In versions of the package affected by this vulnerability, it is possible to circumvent this protection and overwrite prototype properties and functions by prefixing the name of the parameter with [ or ]. e.g. qs.parse("]=toString") will return {toString = true}, as a result, calling toString() on the object will throw an exception.

Example:

qs.parse('toString=foo', { allowPrototypes: false })
// {}

qs.parse("]=toString", { allowPrototypes: false })
// {toString = true} <== prototype overwritten

For more information, you can check out our blog.

Disclosure Timeline

  • February 13th, 2017 - Reported the issue to package owner.
  • February 13th, 2017 - Issue acknowledged by package owner.
  • February 16th, 2017 - Partial fix released in versions 6.0.3, 6.1.1, 6.2.2, 6.3.1.
  • March 6th, 2017 - Final fix released in versions 6.4.0,6.3.2, 6.2.3, 6.1.2 and 6.0.4

Remediation

Upgrade qs to version 6.4.0 or higher. Note: The fix was backported to the following versions 6.3.2, 6.2.3, 6.1.2, 6.0.4.

References

Fixed in 0.7.4

Cross-site Scripting due to improper file and directory names escaping

medium severity
  • Vulnerable module: serve-index
  • Introduced through: express@3.5.3

Detailed paths

  • Introduced through: node-inspector@0.7.3 > express@3.5.3 > connect@2.14.5 > serve-index@1.0.1

Overview

When using serve-index middleware version < 1.6.3 file and directory names are not escaped in HTML output. If remote users can influence file or directory names, this can trigger a persistent XSS attack.

Source: Node Security Project

Remediation

Upgrade to version 1.6.3 or greater

References

Regular Expression Denial of Service (ReDoS)

high severity
  • Vulnerable module: method-override
  • Introduced through: express@3.5.3

Detailed paths

  • Introduced through: node-inspector@0.7.3 > express@3.5.3 > connect@2.14.5 > method-override@1.0.0

Overview

method-override is a module to override HTTP verbs.

Affected versions of this package are vulnerable to Regular expression Denial of Service (ReDoS). It uses regex the following regex / *, */ in order to split HTTP headers. An attacker may send specially crafted input in the X-HTTP-Method-Override header and cause a significant slowdown.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Many Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size), allowing an attacker to exploit this and can cause the program to enter these extreme situations by using a specially crafted input and cause the service to excessively consume CPU, resulting in a Denial of Service.

You can read more about Regular Expression Denial of Service (ReDoS) on our blog.

Remediation

Upgrade method-override to version 2.3.10 or higher.

References

Fixed in 0.7.1

Regular Expression Denial of Service (DoS)

medium severity

Detailed paths

  • Introduced through: node-inspector@0.7.0-2 > socket.io@0.9.19 > socket.io-client@0.9.16 > uglify-js@1.2.5

Overview

The parse() function in the uglify-js package prior to version 2.6.0 is vulnerable to regular expression denial of service (ReDoS) attacks when long inputs of certain patterns are processed.

Details

"The Regular expression Denial of Service (ReDoS) is a Denial of Service attack, that exploits the fact that most Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size). An attacker can then cause a program using a Regular Expression to enter these extreme situations and then hang for a very long time." 1

Remediation

Upgrade to version 2.6.0 or greater. If a direct dependency update is not possible, use snyk wizard to patch this vulnerability.

References

Improper minification of non-boolean comparisons

high severity

Detailed paths

  • Introduced through: node-inspector@0.7.0-2 > socket.io@0.9.19 > socket.io-client@0.9.16 > uglify-js@1.2.5

Overview

uglify-js is a JavaScript parser, minifier, compressor and beautifier toolkit.

Tom MacWright discovered that UglifyJS versions 2.4.23 and earlier are affected by a vulnerability which allows a specially crafted Javascript file to have altered functionality after minification. This bug was demonstrated by Yan to allow potentially malicious code to be hidden within secure code, activated by minification.

Details

In Boolean algebra, DeMorgan's laws describe the relationships between conjunctions (&&), disjunctions (||) and negations (!). In Javascript form, they state that:

 !(a && b) === (!a) || (!b)
 !(a || b) === (!a) && (!b)

The law does not hold true when one of the values is not a boolean however.

Vulnerable versions of UglifyJS do not account for this restriction, and erroneously apply the laws to a statement if it can be reduced in length by it.

Consider this authentication function:

function isTokenValid(user) {
    var timeLeft =
        !!config && // config object exists
        !!user.token && // user object has a token
        !user.token.invalidated && // token is not explicitly invalidated
        !config.uninitialized && // config is initialized
        !config.ignoreTimestamps && // don't ignore timestamps
        getTimeLeft(user.token.expiry); // > 0 if expiration is in the future

    // The token must not be expired
    return timeLeft > 0;
}

function getTimeLeft(expiry) {
  return expiry - getSystemTime();
}

When minified with a vulnerable version of UglifyJS, it will produce the following insecure output, where a token will never expire:

( Formatted for readability )

function isTokenValid(user) {
    var timeLeft = !(                       // negation
        !config                             // config object does not exist
        || !user.token                      // user object does not have a token
        || user.token.invalidated           // token is explicitly invalidated
        || config.uninitialized             // config isn't initialized
        || config.ignoreTimestamps          // ignore timestamps
        || !getTimeLeft(user.token.expiry)  // > 0 if expiration is in the future
    );
    return timeLeft > 0
}

function getTimeLeft(expiry) {
    return expiry - getSystemTime()
}

Remediation

Upgrade UglifyJS to version 2.4.24 or higher.

References

Fixed in 0.3.3

methodOverride Middleware Reflected Cross-site Scripting (XSS)

medium severity

Detailed paths

  • Introduced through: grunt@0.3.2 > connect@1.8.7
  • Introduced through: node-inspector@0.3.2 > express@3.2.6 > connect@2.7.11

Overview

Connect is a stack of middleware that is executed in order in each request.

The "methodOverride" middleware allows the http post to override the method of the request with the value of the _method post key or with the header "x-http-method-override".

Because the user post input was not checked, req.method could contain any kind of value. Because the req.method did not match any common method VERB, connect answered with a 404 page containing the "Cannot [method] [url]" content. The method was not properly encoded for output in the browser.

Source: Node Security Project

Details

Example

~ curl "localhost:3000" -d "_method=<script src=http://nodesecurity.io/xss.js></script>"
Cannot <SCRIPT SRC=HTTP://NODESECURITY.IO/XSS.JS></SCRIPT> /

Mitigation factors

Update to the newest version of Connect or disable methodOverride. It is not possible to avoid the vulnerability if you have enabled this middleware in the top of your stack.

History

Fixed in 0.3.1

Insecure Randomness

medium severity

Detailed paths

  • Introduced through: node-inspector@0.3.0-preview1 > socket.io@0.8.7

Overview

socket.io is a node.js realtime framework server. Affected versions of the package are vulnerable to Insecure Randomness due to the cryptographically insecure Math.random function which can produce predictable values and should not be used in security-sensitive context.

Remediation

Upgrade socket.io to version 0.9.7 or higher.

References

Cross-site Scripting (XSS)

medium severity

Detailed paths

  • Introduced through: node-inspector@0.3.0-preview1 > socket.io@0.8.7

Overview

socket.io is a node.js realtime framework server. Affected versions of the package are vulnerable to Cross-site Scripting (XSS) due to insufficient user input validation in the jsonp-polling function. Attackers may exploit this by injecting arbitrary script into the browser.

You can read more about Cross-site Scripting (XSS) on our blog.

Remediation

Upgrade socket.io to version 0.9.6 or higher.

References

Fixed in 0.2.0-beta4

Denial of Service (DoS)

medium severity

Detailed paths

  • Introduced through: node-inspector@0.2.0-beta3 > connect@1.8.7

Overview

connect is a high performance middleware framework.

Affected versions of the package are vulnerable to Denial of Service (DoS) attacks. It is possible to crash the node server by requesting a url with a trailing backslash in the end.

Remediation

Upgrade connect to version 2.0.0 or higher.

References