jsbin@3.11.23

Collaborative JavaScript Debugging App.

Known vulnerabilities17
Vulnerable paths22
Dependencies196

Denial of Service (Memory Exhaustion)

high severity
  • Vulnerable module: qs
  • Introduced through: express@3.0.6

Detailed paths

  • Introduced through: jsbin@3.11.23 express@3.0.6 connect@2.7.2 qs@0.5.1

Overview

During parsing, the qs module may create a sparse area (an array where not 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

Improper minification of non-boolean comparisons

high severity
  • Vulnerable module: uglify-js
  • Introduced through: hbs@2.4.0

Detailed paths

  • Introduced through: jsbin@3.11.23 hbs@2.4.0 handlebars@1.0.12 uglify-js@2.3.6

Overview

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.

Source: Node Security Project

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.

References

Prototype Override Protection Bypass

high severity
  • Vulnerable module: qs
  • Introduced through: express@3.0.6

Detailed paths

  • Introduced through: jsbin@3.11.23 express@3.0.6 connect@2.7.2 qs@0.5.1

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

Regular Expression Denial of Service (DoS)

high severity
  • Vulnerable module: minimatch
  • Introduced through: sqlite3@2.2.7

Detailed paths

  • Introduced through: jsbin@3.11.23 sqlite3@2.2.7 node-pre-gyp@0.5.22 tar-pack@2.0.1 fstream-ignore@0.0.7 minimatch@0.2.14

Overview

minimatch is a minimalistic matching library used for converting glob expressions into JavaScript RegExp objects.

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).

"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 minimatch to version 3.0.2 or greater.

References

Symlink Arbitrary File Overwrite

high severity
  • Vulnerable module: tar
  • Introduced through: sqlite3@2.2.7

Detailed paths

  • Introduced through: jsbin@3.11.23 sqlite3@2.2.7 node-pre-gyp@0.5.22 tar@1.0.3
  • Introduced through: jsbin@3.11.23 sqlite3@2.2.7 node-pre-gyp@0.5.22 tar-pack@2.0.1 tar@0.1.20

Overview

The tar module prior to version 2.0.0 does not properly normalize symbolic links pointing to targets outside the extraction root. As a result, packages may hold symbolic links to parent and sibling directories and overwrite those files when the package is extracted.

Remediation

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

References

Content Injection (XSS)

medium severity
  • Vulnerable module: handlebars
  • Introduced through: hbs@2.4.0

Detailed paths

  • Introduced through: jsbin@3.11.23 hbs@2.4.0 handlebars@1.0.12

Overview

When using attributes without quotes in a handlebars template, an attacker can manipulate the input to introduce additional attributes, potentially executing code. This may lead to a Cross-Site Scripting (XSS) vulnerability, assuming an attacker can influence the value entered into the template. If the handlebars template is used to render user-generated content, this vulnerability may escalate to a persistent XSS vulnerability.

Details

Example:

Assume handlebars was used to display user comments and avatar, using the following template: <img src={{avatarUrl}}><pre>{{comment}}</pre>

If an attacker spoofed their avatar URL and provided the following value: http://evil.org/avatar.png onload=alert(document.cookie)

The resulting HTML would be the following, triggering the script once the image loads: <img src=http://evil.org/avatar.png onload=alert(document.cookie)><pre>Gotcha!</pre>

References

Cross-site Scripting (XSS)

medium severity
  • Vulnerable module: express
  • Introduced through: express@3.0.6

Detailed paths

  • Introduced through: jsbin@3.11.23 express@3.0.6

Overview

express is a minimalist web framework.

Vulnerable versions of this package do not enforce the user's browser to set a specific charset in the content-type header 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 or higher for the 3.x versions or 4.5.0 or higher for the 4.x versions.

References

Denial of Service (Event Loop Blocking)

medium severity
  • Vulnerable module: qs
  • Introduced through: express@3.0.6

Detailed paths

  • Introduced through: jsbin@3.11.23 express@3.0.6 connect@2.7.2 qs@0.5.1

Overview

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

https://nodesecurity.io/advisories/28

Directory Traversal

medium severity
  • Vulnerable module: send
  • Introduced through: express@3.0.6

Detailed paths

  • Introduced through: jsbin@3.11.23 express@3.0.6 send@0.1.0
  • Introduced through: jsbin@3.11.23 express@3.0.6 connect@2.7.2 send@0.1.0

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
  • Vulnerable module: cookie-signature
  • Introduced through: express@3.0.6

Detailed paths

  • Introduced through: jsbin@3.11.23 express@3.0.6 cookie-signature@0.0.1
  • Introduced through: jsbin@3.11.23 express@3.0.6 connect@2.7.2 cookie-signature@0.0.1

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.

Details

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

Regular Expression Denial of Service (DoS)

medium severity
  • Vulnerable module: moment
  • Introduced through: moment@2.5.1

Detailed paths

  • Introduced through: jsbin@3.11.23 moment@2.5.1

Overview

moment is a lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.

Affected versions of the package are vulnerable to Regular Expression Denial of Service (ReDoS) attacks for any locale that has separate format and standalone options and format input can be controlled by the user.

An attacker can provide a specially crafted input to the format 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).

Disclosure Timeline

  • October 19th, 2016 - Reported the issue to package owner.
  • October 19th, 2016 - Issue acknowledged by package owner.
  • October 24th, 2016 - Issue fixed and version 2.15.2 released.

References

Regular Expression Denial of Service (DoS)

medium severity
  • Vulnerable module: uglify-js
  • Introduced through: hbs@2.4.0

Detailed paths

  • Introduced through: jsbin@3.11.23 hbs@2.4.0 handlebars@1.0.12 uglify-js@2.3.6

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

Root Path Disclosure

medium severity
  • Vulnerable module: send
  • Introduced through: express@3.0.6

Detailed paths

  • Introduced through: jsbin@3.11.23 express@3.0.6 send@0.1.0
  • Introduced through: jsbin@3.11.23 express@3.0.6 connect@2.7.2 send@0.1.0

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

Unauthorized SSL Connection due to lack of cert authentication

medium severity
  • Vulnerable module: mysql
  • Introduced through: mysql@2.0.1

Detailed paths

  • Introduced through: jsbin@3.11.23 mysql@2.0.1

Overview

mysql is a node.js driver for mysql. Affected versions of this package do not validate that the remote server has a trusted SSL certificate or not, making it easier for attackers to gain access to the MySQL Server.

Remediation

Upgrade mysql to version 2.3.0 or higher.

References

methodOverride Middleware Reflected Cross-site Scripting (XSS)

medium severity
  • Vulnerable module: connect
  • Introduced through: express@3.0.6

Detailed paths

  • Introduced through: jsbin@3.11.23 express@3.0.6 connect@2.7.2

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

semver Regular Expression Denial of Service (DoS)

medium severity
  • Vulnerable module: semver
  • Introduced through: semver@2.1.0 and sqlite3@2.2.7

Detailed paths

  • Introduced through: jsbin@3.11.23 semver@2.1.0
  • Introduced through: jsbin@3.11.23 sqlite3@2.2.7 node-pre-gyp@0.5.22 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

Regular Expression Denial of Service (DoS)

low severity
  • Vulnerable module: moment
  • Introduced through: moment@2.5.1

Detailed paths

  • Introduced through: jsbin@3.11.23 moment@2.5.1

Overview

moment is a lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.

An attacker can provide a long value to the duration 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).

"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 moment to version 2.11.2 or greater.

References