express@3.0.6

Fast, unopinionated, minimalist web framework.
Vulnerabilities 10 via 17 paths
Dependencies 17
Source npm

Snyk continuously finds and fixes vulnerabilities in your dependencies.

Filter by issue type
  • 3
  • 6
  • 1
Filter by issue policy
  • 0
  • 0
high severity

Denial of Service (Memory Exhaustion)

  • Vulnerable module: qs
  • Introduced through: connect@2.7.2

Detailed paths

  • Introduced through: express@3.0.6 connect@2.7.2 qs@0.5.1
    Remediation: Upgrade to express@3.16.0.

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

high severity

Prototype Override Protection Bypass

  • Vulnerable module: qs
  • Introduced through: connect@2.7.2

Detailed paths

  • Introduced through: express@3.0.6 connect@2.7.2 qs@0.5.1
    Remediation: Upgrade to express@4.0.0.

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

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: fresh
  • Introduced through: fresh@0.1.0, send@0.1.0 and others

Detailed paths

  • Introduced through: express@3.0.6 fresh@0.1.0
    Remediation: Upgrade to express@4.15.5.
  • Introduced through: express@3.0.6 send@0.1.0 fresh@0.1.0
    Remediation: Upgrade to express@4.15.5.
  • Introduced through: express@3.0.6 connect@2.7.2 send@0.1.0 fresh@0.1.0
    Remediation: Upgrade to express@4.0.0.
  • Introduced through: express@3.0.6 connect@2.7.2 fresh@0.1.0
    Remediation: Upgrade to express@4.0.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

medium severity

Cross-site Scripting (XSS)

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

Detailed paths

  • Introduced through: express@3.0.6
    Remediation: Upgrade to express@3.11.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

medium severity

Denial of Service (Event Loop Blocking)

  • Vulnerable module: qs
  • Introduced through: connect@2.7.2

Detailed paths

  • Introduced through: express@3.0.6 connect@2.7.2 qs@0.5.1
    Remediation: Upgrade to express@3.16.0.

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

medium severity

Directory Traversal

  • Vulnerable module: send
  • Introduced through: send@0.1.0 and connect@2.7.2

Detailed paths

  • Introduced through: express@3.0.6 send@0.1.0
    Remediation: Upgrade to express@3.16.10.
  • Introduced through: express@3.0.6 connect@2.7.2 send@0.1.0
    Remediation: Upgrade to express@4.0.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

medium severity

Non-Constant Time String Comparison

  • Vulnerable module: cookie-signature
  • Introduced through: cookie-signature@0.0.1 and connect@2.7.2

Detailed paths

  • Introduced through: express@3.0.6 cookie-signature@0.0.1
    Remediation: Upgrade to express@3.12.1.
  • Introduced through: express@3.0.6 connect@2.7.2 cookie-signature@0.0.1
    Remediation: Upgrade to express@3.12.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.

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

medium severity

Root Path Disclosure

  • Vulnerable module: send
  • Introduced through: send@0.1.0 and connect@2.7.2

Detailed paths

  • Introduced through: express@3.0.6 send@0.1.0
    Remediation: Upgrade to express@3.19.1.
  • Introduced through: express@3.0.6 connect@2.7.2 send@0.1.0
    Remediation: Upgrade to express@4.0.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

medium severity

methodOverride Middleware Reflected Cross-site Scripting (XSS)

  • Vulnerable module: connect
  • Introduced through: connect@2.7.2

Detailed paths

  • Introduced through: express@3.0.6 connect@2.7.2
    Remediation: Upgrade to express@3.3.1.

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

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: mime
  • Introduced through: send@0.1.0 and connect@2.7.2

Detailed paths

  • Introduced through: express@3.0.6 send@0.1.0 mime@1.2.6
    Remediation: Upgrade to express@4.16.0.
  • Introduced through: express@3.0.6 connect@2.7.2 send@0.1.0 mime@1.2.6
    Remediation: Upgrade to express@4.0.0.

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