RayBenefield/dev-xp

Vulnerabilities

67 via 164 paths

Dependencies

1327

Source

GitHub

Commit

c233c87d

Find, fix and prevent vulnerabilities in your code.

Severity
  • 3
  • 18
  • 41
  • 5
Status
  • 67
  • 0
  • 0

critical severity

Remote Code Execution (RCE)

  • Vulnerable module: vm2
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 proxy-agent@5.0.0 pac-proxy-agent@5.0.0 pac-resolver@5.0.1 degenerator@3.0.4 vm2@3.9.19

Overview

vm2 is a sandbox that can run untrusted code with whitelisted Node's built-in modules.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) due to insufficient checks which allow an attacker to escape the sandbox.

Note:

According to the maintainer, the security issue cannot be properly addressed and the library will be discontinued.

Remediation

There is no fixed version for vm2.

References

critical severity

Remote Code Execution (RCE)

  • Vulnerable module: vm2
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 proxy-agent@5.0.0 pac-proxy-agent@5.0.0 pac-resolver@5.0.1 degenerator@3.0.4 vm2@3.9.19

Overview

vm2 is a sandbox that can run untrusted code with whitelisted Node's built-in modules.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) such that the Promise handler sanitization can be bypassed, allowing attackers to escape the sandbox.

Note:

According to the maintainer, the security issue cannot be properly addressed and the library will be discontinued.

Remediation

There is no fixed version for vm2.

References

critical severity

Incomplete List of Disallowed Inputs

  • Vulnerable module: babel-traverse
  • Introduced through: babel-core@6.26.3 and babel-plugin-transform-async-to-generator@6.24.1

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-traverse@6.26.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-traverse@6.26.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-helpers@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0

…and 4 more

Overview

Affected versions of this package are vulnerable to Incomplete List of Disallowed Inputs when using plugins that rely on the path.evaluate() or path.evaluateTruthy() internal Babel methods.

Note:

This is only exploitable if the attacker uses known affected plugins such as @babel/plugin-transform-runtime, @babel/preset-env when using its useBuiltIns option, and any "polyfill provider" plugin that depends on @babel/helper-define-polyfill-provider. No other plugins under the @babel/ namespace are impacted, but third-party plugins might be.

Users that only compile trusted code are not impacted.

Workaround

Users who are unable to upgrade the library can upgrade the affected plugins instead, to avoid triggering the vulnerable code path in affected @babel/traverse.

Remediation

There is no fixed version for babel-traverse.

References

high severity

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to NULL Pointer Dereference in the function Sass::Functions::selector_append which could be leveraged by an attacker to cause a denial of service (application crash) or possibly have unspecified other impact. node-sass is affected by this vulnerability due to its bundled usage of libsass.

Remediation

There is no fixed version for node-sass.

References

high severity

Use After Free

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to Use After Free via the SharedPtr class in SharedPtr.cpp (or SharedPtr.hpp) that may cause a denial of service (application crash) or possibly have unspecified other impact. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.

Details

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

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 node-sass.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: cross-spawn
  • Introduced through: execa@0.8.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 execa@0.8.0 cross-spawn@5.1.0
    Remediation: Upgrade to execa@0.10.0.

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

Prototype Pollution

  • Vulnerable module: protobufjs
  • Introduced through: firebase-admin@9.12.0 and firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 @google-cloud/firestore@4.15.1 google-gax@2.30.5 protobufjs@6.11.3
    Remediation: Upgrade to firebase-admin@11.1.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 @google-cloud/pubsub@2.19.4 google-gax@2.30.3 protobufjs@6.11.2
    Remediation: Upgrade to firebase-tools@11.1.0.

Overview

protobufjs is a protocol buffer for JavaScript (& TypeScript).

Affected versions of this package are vulnerable to Prototype Pollution. A user-controlled protobuf message can be used by an attacker to pollute the prototype of Object.prototype by adding and overwriting its data and functions. Exploitation can involve:

  1. using the function parse to parse protobuf messages on the fly,

  2. loading .proto files by using load/loadSync functions, or

  3. providing untrusted input to the functions ReflectionObject.setParsedOption and util.setProperty

Note:

  1. This is a different issue from CVE-2022-25878

  2. Users who use this package from npm can rest assured that version 7.2.4 includes the fixed code.

Developers using this package from a different CDN should consider 7.2.5 as the fixed version.

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 protobufjs to version 6.11.4, 7.2.4 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: lodash-es
  • Introduced through: rete-context-menu-plugin@0.6.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rete-context-menu-plugin@0.6.0 lodash-es@4.17.15
    Remediation: Upgrade to rete-context-menu-plugin@2.0.0.

Overview

Affected versions of this package are vulnerable to Prototype Pollution. The function zipObjectDeep can be tricked into adding or modifying properties of the Object prototype. These properties will be present on all objects.

PoC

const _ = require('lodash');

_.zipObjectDeep(['__proto__.z'],[123]);

console.log(z); // 123

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 lodash-es to version 4.17.20 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: protobufjs
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 @google-cloud/pubsub@2.19.4 google-gax@2.30.3 protobufjs@6.11.2
    Remediation: Upgrade to firebase-tools@11.1.0.

Overview

protobufjs is a protocol buffer for JavaScript (& TypeScript).

Affected versions of this package are vulnerable to Prototype Pollution which can allow an attacker to add/modify properties of the Object.prototype.

This vulnerability can occur in multiple ways:

  1. by providing untrusted user input to util.setProperty or to ReflectionObject.setParsedOption functions
  2. by parsing/loading .proto files

PoC

// npm i protobufjs
const protobuf = require("protobufjs");

// poc 1 - util.setProperty()
protobuf.util.setProperty({}, "__proto__.polluted1", "polluted1");
console.log({}.polluted1);

// poc 2 - ReflectionObject().setParsedOption()
let obj = new protobuf.ReflectionObject("Test")
let dst = {}
obj.setParsedOption(dst, "polluted2", "__proto__.polluted2");
console.log({}.polluted2);

// poc 3 - protobuf.parse()
let p =
`
option (foo).__proto__.polluted3 = "polluted3";
`
protobuf.parse(p)
console.log({}.polluted3)

// poc 4 - protobuf.load()
/* poc.proto

option (foo).__proto__.polluted4 = "polluted4";

syntax = "proto3";

message Message {
string bar = 1;
}
*/
protobuf.load("poc.proto", function(err, root) {
if (err)
throw err;
console.log({}.polluted4)
});

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 protobufjs to version 6.10.3, 6.11.3 or higher.

References

high severity

Command Injection

  • Vulnerable module: simple-git
  • Introduced through: simple-git@1.132.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 simple-git@1.132.0
    Remediation: Upgrade to simple-git@3.3.0.

Overview

simple-git is a light weight interface for running git commands in any node.js application.

Affected versions of this package are vulnerable to Command Injection via argument injection. When calling the .fetch(remote, branch, handlerFn) function, both the remote and branch parameters are passed to the git fetch subcommand. By injecting some git options it was possible to get arbitrary command execution.

PoC

// npm i simple-git
const simpleGit = require('simple-git');
const git = simpleGit();

let callback = () => {};

git.init(); // or git init

let origin1 = 'origin';
let ref1 = "--upload-pack=touch ./HELLO1;";
git.fetch(origin1, ref1,  callback); // git [ 'fetch', 'origin', '--upload-pack=touch ./HELLO1;' ]

let origin2 = "--upload-pack=touch ./HELLO2;";
let ref2 = "foo";
git.fetch(origin2, ref2,  callback); // git [ 'fetch', '--upload-pack=touch ./HELLO2;', 'foo' ]


let origin3 = 'origin';
let ref3 = "--upload-pack=touch ./HELLO3;";
git.fetch(origin3, ref3, { '--depth': '2' }, callback); // git [ 'fetch', '--depth=2', 'origin', '--upload-pack=touch ./HELLO3;' ]

// ls -la

Remediation

Upgrade simple-git to version 3.3.0 or higher.

References

high severity

Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')

  • Vulnerable module: simple-git
  • Introduced through: simple-git@1.132.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 simple-git@1.132.0
    Remediation: Upgrade to simple-git@3.5.0.

Overview

simple-git is a light weight interface for running git commands in any node.js application.

Affected versions of this package are vulnerable to Improper Neutralization of Argument Delimiters in a Command ('Argument Injection') due to an incomplete fix of CVE-2022-24433 which only patches against the git fetch attack vector. A similar use of the --upload-pack feature of git is also supported for git clone, which the prior fix didn't cover.

PoC

const simpleGit = require('simple-git')
const git2 = simpleGit()
git2.clone('file:///tmp/zero123', '/tmp/example-new-repo', ['--upload-pack=touch /tmp/pwn']);

Remediation

Upgrade simple-git to version 3.5.0 or higher.

References

high severity

Remote Code Execution (RCE)

  • Vulnerable module: simple-git
  • Introduced through: simple-git@1.132.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 simple-git@1.132.0
    Remediation: Upgrade to simple-git@3.15.0.

Overview

simple-git is a light weight interface for running git commands in any node.js application.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) when enabling the ext transport protocol, which makes it exploitable via clone() method. This vulnerability exists due to an incomplete fix of CVE-2022-24066.

PoC

const simpleGit = require('simple-git')
const git2 = simpleGit()
git2.clone('ext::sh -c touch% /tmp/pwn% >&2', '/tmp/example-new-repo', ["-c", "protocol.ext.allow=always"]);

Remediation

Upgrade simple-git to version 3.15.0 or higher.

References

high severity

Remote Code Execution (RCE)

  • Vulnerable module: simple-git
  • Introduced through: simple-git@1.132.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 simple-git@1.132.0
    Remediation: Upgrade to simple-git@3.16.0.

Overview

simple-git is a light weight interface for running git commands in any node.js application.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) via the clone(), pull(), push() and listRemote() methods, due to improper input sanitization. This vulnerability exists due to an incomplete fix of CVE-2022-25912.

PoC

const simpleGit = require('simple-git');
let git = simpleGit();
git.clone('-u touch /tmp/pwn', 'file:///tmp/zero12');
git.pull('--upload-pack=touch /tmp/pwn0', 'master');
git.push('--receive-pack=touch /tmp/pwn1', 'master');
git.listRemote(['--upload-pack=touch /tmp/pwn2', 'main']);

Remediation

Upgrade simple-git to version 3.16.0 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: ansi-regex
  • Introduced through: renderkid@2.0.7, firebase-tools@9.23.3 and others

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 renderkid@2.0.7 strip-ansi@3.0.1 ansi-regex@2.1.1
    Remediation: Upgrade to renderkid@3.0.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 cli-color@1.4.0 ansi-regex@2.1.1
    Remediation: Upgrade to firebase-tools@11.4.1.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-code-frame@6.26.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 superstatic@7.1.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
    Remediation: Upgrade to firebase-tools@11.14.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-code-frame@6.26.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 superstatic@7.1.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
    Remediation: Upgrade to firebase-tools@11.14.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 superstatic@7.1.0 string-length@1.0.1 strip-ansi@3.0.1 ansi-regex@2.1.1
    Remediation: Upgrade to firebase-tools@11.14.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 npmlog@4.1.2 gauge@2.7.4 strip-ansi@3.0.1 ansi-regex@2.1.1
    Remediation: Upgrade to node-sass@7.0.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 npmlog@4.1.2 gauge@2.7.4 string-width@1.0.2 strip-ansi@3.0.1 ansi-regex@2.1.1
    Remediation: Upgrade to node-sass@7.0.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 node-gyp@7.1.2 npmlog@4.1.2 gauge@2.7.4 strip-ansi@3.0.1 ansi-regex@2.1.1
    Remediation: Upgrade to node-sass@7.0.1.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-wick@4.0.3 node-pre-gyp@0.12.0 npmlog@4.1.2 gauge@2.7.4 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 wick-downloader@0.3.4 node-pre-gyp@0.14.0 npmlog@4.1.2 gauge@2.7.4 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-template@6.26.0 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 postcss@5.2.18 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-template@6.26.0 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 postcss@5.2.18 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 node-gyp@7.1.2 npmlog@4.1.2 gauge@2.7.4 string-width@1.0.2 strip-ansi@3.0.1 ansi-regex@2.1.1
    Remediation: Upgrade to node-sass@7.0.1.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-wick@4.0.3 node-pre-gyp@0.12.0 npmlog@4.1.2 gauge@2.7.4 string-width@1.0.2 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 wick-downloader@0.3.4 node-pre-gyp@0.14.0 npmlog@4.1.2 gauge@2.7.4 string-width@1.0.2 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-helpers@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 babel-helpers@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 @npmcli/run-script@1.8.6 node-gyp@7.1.2 npmlog@4.1.2 gauge@2.7.4 strip-ansi@3.0.1 ansi-regex@2.1.1
    Remediation: Upgrade to rollup-plugin-filesize@10.0.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 has-ansi@2.0.0 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0 babel-code-frame@6.26.0 chalk@1.1.3 strip-ansi@3.0.1 ansi-regex@2.1.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 @npmcli/run-script@1.8.6 node-gyp@7.1.2 npmlog@4.1.2 gauge@2.7.4 string-width@1.0.2 strip-ansi@3.0.1 ansi-regex@2.1.1
    Remediation: Upgrade to rollup-plugin-filesize@10.0.0.

…and 32 more

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to the sub-patterns [[\\]()#;?]* and (?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*.

PoC

import ansiRegex from 'ansi-regex';

for(var i = 1; i <= 50000; i++) {
    var time = Date.now();
    var attack_str = "\u001B["+";".repeat(i*10000);
    ansiRegex().test(attack_str)
    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 ansi-regex to version 3.0.1, 4.1.1, 5.0.1, 6.0.1 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: dicer
  • Introduced through: firebase-admin@9.12.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 dicer@0.3.1

Overview

Affected versions of this package are vulnerable to Denial of Service (DoS). A malicious attacker can send a modified form to server, and crash the nodejs service. An attacker could sent the payload again and again so that the service continuously crashes.

PoC

await fetch('http://127.0.0.1:8000', { method: 'POST', headers: { ['content-type']: 'multipart/form-data; boundary=----WebKitFormBoundaryoo6vortfDzBsDiro', ['content-length']: '145', connection: 'keep-alive', }, body: '------WebKitFormBoundaryoo6vortfDzBsDiro\r\n Content-Disposition: form-data; name="bildbeschreibung"\r\n\r\n\r\n------WebKitFormBoundaryoo6vortfDzBsDiro--' });

Remediation

There is no fixed version for dicer.

References

high severity

Prototype Pollution

  • Vulnerable module: loader-utils
  • Introduced through: rollup-plugin-vue@4.7.2

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 generic-names@1.0.3 loader-utils@0.2.17

Overview

Affected versions of this package are vulnerable to Prototype Pollution in parseQuery function via the name variable in parseQuery.js. This pollutes the prototype of the object returned by parseQuery and not the global Object prototype (which is the commonly understood definition of Prototype Pollution). Therefore, the actual impact will depend on how applications utilize the returned object and how they filter unwanted keys.

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 loader-utils to version 1.4.1, 2.0.3 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: trim-newlines
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 meow@3.7.0 trim-newlines@1.0.0
    Remediation: Upgrade to node-sass@6.0.1.

Overview

trim-newlines is a Trim newlines from the start and/or end of a string

Affected versions of this package are vulnerable to Denial of Service (DoS) via the end() method.

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 trim-newlines to version 3.0.1, 4.0.1 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: lodash-es
  • Introduced through: rete-context-menu-plugin@0.6.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rete-context-menu-plugin@0.6.0 lodash-es@4.17.15
    Remediation: Upgrade to rete-context-menu-plugin@2.0.0.

Overview

Affected versions of this package are vulnerable to Prototype Pollution via the set and setwith functions due to improper user input sanitization.

PoC

lod = require('lodash')
lod.set({}, "__proto__[test2]", "456")
console.log(Object.prototype)

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 lodash-es to version 4.17.20 or higher.

References

high severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: node-forge
  • Introduced through: firebase-admin@9.12.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 node-forge@0.10.0
    Remediation: Upgrade to firebase-admin@10.0.2.

Overview

node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature due to RSA's PKCS#1 v1.5 signature verification code which does not check for tailing garbage bytes after decoding a DigestInfo ASN.1 structure. This can allow padding bytes to be removed and garbage data added to forge a signature when a low public exponent is being used.

Remediation

Upgrade node-forge to version 1.3.0 or higher.

References

high severity

Code Injection

  • Vulnerable module: lodash-es
  • Introduced through: rete-context-menu-plugin@0.6.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rete-context-menu-plugin@0.6.0 lodash-es@4.17.15
    Remediation: Upgrade to rete-context-menu-plugin@2.0.0.

Overview

Affected versions of this package are vulnerable to Code Injection via template.

PoC

var _ = require('lodash');

_.template('', { variable: '){console.log(process.env)}; with(obj' })()

Remediation

Upgrade lodash-es to version 4.17.21 or higher.

References

high severity

Cross-site Request Forgery (CSRF)

  • Vulnerable module: axios
  • Introduced through: axios@0.21.4

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 axios@0.21.4
    Remediation: Upgrade to axios@0.28.0.

Overview

axios is a promise-based HTTP client for the browser and Node.js.

Affected versions of this package are vulnerable to Cross-site Request Forgery (CSRF) due to inserting the X-XSRF-TOKEN header using the secret XSRF-TOKEN cookie value in all requests to any server when the XSRF-TOKEN0 cookie is available, and the withCredentials setting is turned on. If a malicious user manages to obtain this value, it can potentially lead to the XSRF defence mechanism bypass.

Workaround

Users should change the default XSRF-TOKEN cookie name in the Axios configuration and manually include the corresponding header only in the specific places where it's necessary.

Remediation

Upgrade axios to version 0.28.0, 1.6.0 or higher.

References

medium severity

Uncontrolled Resource Consumption

  • Vulnerable module: @grpc/grpc-js
  • Introduced through: firebase-admin@9.12.0 and firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 @google-cloud/firestore@4.15.1 google-gax@2.30.5 @grpc/grpc-js@1.6.12
    Remediation: Upgrade to firebase-admin@11.1.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 @google-cloud/pubsub@2.19.4 google-gax@2.30.3 @grpc/grpc-js@1.6.12
    Remediation: Upgrade to firebase-tools@11.1.0.

Overview

@grpc/grpc-js is a gRPC Library for Node

Affected versions of this package are vulnerable to Uncontrolled Resource Consumption via the grpc.max_receive_message_length channel option. An attacker can cause a denial of service by sending messages that exceed the configured limits, which are then buffered or decompressed into memory.

Remediation

Upgrade @grpc/grpc-js to version 1.8.22, 1.9.15, 1.10.9 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: find-my-way
  • Introduced through: restify@8.6.1

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 restify@8.6.1 find-my-way@2.2.5

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when including two parameters ending with - in a single segment, which causes inefficient backtracking when parsing the string into a regular expression. The resulting poor performance can lead to denial of service.

Note:

This vulnerability is similar to the path-to-regexp ReDoS Vulnerability

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 find-my-way to version 8.2.2, 9.0.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: path-to-regexp
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 superstatic@7.1.0 router@1.3.8 path-to-regexp@0.1.7
    Remediation: Upgrade to firebase-tools@11.14.0.

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when including multiple regular expression parameters in a single segment, which will produce the regular expression /^\/([^\/]+?)-([^\/]+?)\/?$/, if two parameters within a single segment are separated by a character other than a / or .. Poor performance will block the event loop and can lead to a DoS.

Note: While the 8.0.0 release has completely eliminated the vulnerable functionality, prior versions that have received the patch to mitigate backtracking may still be vulnerable if custom regular expressions are used. So it is strongly recommended for regular expression input to be controlled to avoid malicious performance degradation in those versions. This behavior is enforced as of version 7.1.0 via the strict option, which returns an error if a dangerous regular expression is detected.

Workaround

This vulnerability can be avoided by using a custom regular expression for parameters after the first in a segment, which excludes - and /.

PoC

/a${'-a'.repeat(8_000)}/a

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 path-to-regexp to version 0.1.10, 1.9.0, 3.3.0, 6.3.0, 8.0.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: path-to-regexp
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 superstatic@7.1.0 router@1.3.8 path-to-regexp@0.1.7
    Remediation: Upgrade to firebase-tools@11.14.0.

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when including multiple regular expression parameters in a single segment, when the separator is not . (e.g. no /:a-:b). Poor performance will block the event loop and can lead to a DoS.

Note:

This issue is caused due to an incomplete fix for CVE-2024-45296.

Workarounds

This can be mitigated by avoiding using two parameters within a single path segment, when the separator is not . (e.g. no /:a-:b). Alternatively, the regex used for both parameters can be defined to ensure they do not overlap to allow backtracking.

PoC

/a${'-a'.repeat(8_000)}/a

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 path-to-regexp to version 0.1.12 or higher.

References

medium severity

Use of a Broken or Risky Cryptographic Algorithm

  • Vulnerable module: jsonwebtoken
  • Introduced through: firebase-admin@9.12.0 and firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 jsonwebtoken@8.5.1
    Remediation: Upgrade to firebase-admin@11.4.1.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 jsonwebtoken@8.5.1
    Remediation: Upgrade to firebase-tools@11.21.0.

Overview

jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)

Affected versions of this package are vulnerable to Use of a Broken or Risky Cryptographic Algorithm such that the library can be misconfigured to use legacy, insecure key types for signature verification. For example, DSA keys could be used with the RS256 algorithm.

Exploitability

Users are affected when using an algorithm and a key type other than the combinations mentioned below:

EC: ES256, ES384, ES512

RSA: RS256, RS384, RS512, PS256, PS384, PS512

RSA-PSS: PS256, PS384, PS512

And for Elliptic Curve algorithms:

ES256: prime256v1

ES384: secp384r1

ES512: secp521r1

Workaround

Users who are unable to upgrade to the fixed version can use the allowInvalidAsymmetricKeyTypes option to true in the sign() and verify() functions to continue usage of invalid key type/algorithm combination in 9.0.0 for legacy compatibility.

Remediation

Upgrade jsonwebtoken to version 9.0.0 or higher.

References

medium severity

Server-Side Request Forgery (SSRF)

  • Vulnerable module: ip
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 proxy-agent@5.0.0 pac-proxy-agent@5.0.0 pac-resolver@5.0.1 ip@1.1.9

Overview

ip is a Node library.

Affected versions of this package are vulnerable to Server-Side Request Forgery (SSRF) via the isPublic function, which identifies some private IP addresses as public addresses due to improper parsing of the input. An attacker can manipulate a system that uses isLoopback(), isPrivate() and isPublic functions to guard outgoing network requests to treat certain IP addresses as globally routable by supplying specially crafted IP addresses.

Note

This vulnerability derived from an incomplete fix for CVE-2023-42282

Remediation

There is no fixed version for ip.

References

medium severity

Improper Restriction of Security Token Assignment

  • Vulnerable module: jsonwebtoken
  • Introduced through: firebase-admin@9.12.0 and firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 jsonwebtoken@8.5.1
    Remediation: Upgrade to firebase-admin@11.4.1.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 jsonwebtoken@8.5.1
    Remediation: Upgrade to firebase-tools@11.21.0.

Overview

jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)

Affected versions of this package are vulnerable to Improper Restriction of Security Token Assignment via the secretOrPublicKey argument due to misconfigurations of the key retrieval function jwt.verify(). Exploiting this vulnerability might result in incorrect verification of forged tokens when tokens signed with an asymmetric public key could be verified with a symmetric HS256 algorithm.

Note: This vulnerability affects your application if it supports the usage of both symmetric and asymmetric keys in jwt.verify() implementation with the same key retrieval function.

Remediation

Upgrade jsonwebtoken to version 9.0.0 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to Denial of Service (DoS). Uncontrolled recursion is possible in Sass::Complex_Selector::perform in ast.hpp and Sass::Inspect::operator in inspect.cpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.

Details

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

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 node-sass.

References

medium severity

Out-of-Bounds

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to Out-of-Bounds. A heap-based buffer over-read exists in Sass::Prelexer::parenthese_scope in prelexer.hpp. node-sass is affected by this vulnerability due to its bundled usage of libsass.

Remediation

There is no fixed version for node-sass.

References

medium severity

Out-of-Bounds

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to Out-of-Bounds via Sass::Prelexer::alternatives in prelexer.hpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.

Details

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

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 node-sass.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to Out-of-bounds Read. The function handle_error in sass_context.cpp allows attackers to cause a denial-of-service resulting from a heap-based buffer over-read via a crafted sass file. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.

Details

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

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 node-sass.

References

medium severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: request
  • Introduced through: firebase-tools@9.23.3, node-sass@5.0.0 and others

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 request@2.88.2
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 request@2.88.2
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 simple-oauth2@1.6.0 request@2.88.2
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 twitter@1.7.1 request@2.88.2
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 universal-analytics@0.4.23 request@2.88.2
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 node-gyp@7.1.2 request@2.88.2
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 @npmcli/run-script@1.8.6 node-gyp@7.1.2 request@2.88.2

…and 4 more

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

Uncontrolled Resource Consumption ('Resource Exhaustion')

  • Vulnerable module: tar
  • Introduced through: firebase-tools@9.23.3, node-wick@4.0.3 and others

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 tar@4.4.19
    Remediation: Upgrade to firebase-tools@10.1.2.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-wick@4.0.3 node-pre-gyp@0.12.0 tar@4.4.19
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 wick-downloader@0.3.4 node-pre-gyp@0.14.0 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: firebase-tools@9.23.3, node-sass@5.0.0 and others

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 simple-oauth2@1.6.0 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 twitter@1.7.1 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 universal-analytics@0.4.23 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 node-gyp@7.1.2 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 @npmcli/run-script@1.8.6 node-gyp@7.1.2 request@2.88.2 tough-cookie@2.5.0

…and 4 more

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

Prototype Pollution

  • Vulnerable module: json5
  • Introduced through: babel-core@6.26.3 and rollup-plugin-vue@4.7.2

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 babel-core@6.26.3 json5@0.5.1
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 generic-names@1.0.3 loader-utils@0.2.17 json5@0.5.1

Overview

Affected versions of this package are vulnerable to Prototype Pollution via the parse method , which does not restrict parsing of keys named __proto__, allowing specially crafted strings to pollute the prototype of the resulting object. This pollutes the prototype of the object returned by JSON5.parse and not the global Object prototype (which is the commonly understood definition of Prototype Pollution). Therefore, the actual impact will depend on how applications utilize the returned object and how they filter unwanted keys.

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 json5 to version 1.0.2, 2.2.2 or higher.

References

medium severity

Improper Authentication

  • Vulnerable module: jsonwebtoken
  • Introduced through: firebase-admin@9.12.0 and firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 jsonwebtoken@8.5.1
    Remediation: Upgrade to firebase-admin@11.4.1.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 jsonwebtoken@8.5.1
    Remediation: Upgrade to firebase-tools@11.21.0.

Overview

jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)

Affected versions of this package are vulnerable to Improper Authentication such that the lack of algorithm definition in the jwt.verify() function can lead to signature validation bypass due to defaulting to the none algorithm for signature verification.

Exploitability

Users are affected only if all of the following conditions are true for the jwt.verify() function:

  1. A token with no signature is received.

  2. No algorithms are specified.

  3. A falsy (e.g., null, false, undefined) secret or key is passed.

Remediation

Upgrade jsonwebtoken to version 9.0.0 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: node-forge
  • Introduced through: firebase-admin@9.12.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 node-forge@0.10.0
    Remediation: Upgrade to firebase-admin@10.0.2.

Overview

node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.

Affected versions of this package are vulnerable to Prototype Pollution via the forge.debug API if called with untrusted input.

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 node-forge to version 1.0.0 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: vue-template-compiler
  • Introduced through: vue-template-compiler@2.7.16

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 vue-template-compiler@2.7.16

Overview

vue-template-compiler is a template compiler for Vue 2.0

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) through the manipulation of object properties such as Object.prototype.staticClass or Object.prototype.staticStyle. An attacker can execute arbitrary JavaScript code by altering the prototype chain of these properties.

Note: This vulnerability is not present in Vue 3.

PoC

<head>
  <script>
    window.Proxy = undefined // Not necessary, but helpfull in demonstrating breaking out into `window.alert`
    Object.prototype.staticClass = `alert("Polluted")`
  </script>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
</head>

<body>
  <div id="app"></div>
  <script>
    new window.Vue({
      template: `<div class="">Content</div>`,
    }).$mount('#app')
  </script>
</body>

Details

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

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

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

References

medium severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: axios
  • Introduced through: axios@0.21.4

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 axios@0.21.4
    Remediation: Upgrade to axios@0.30.0.

Overview

axios is a promise-based HTTP client for the browser and Node.js.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) due to the allowAbsoluteUrls attribute being ignored in the call to the buildFullPath function from the HTTP adapter. An attacker could launch SSRF attacks or exfiltrate sensitive data by tricking applications into sending requests to malicious endpoints.

PoC

const axios = require('axios');
const client = axios.create({baseURL: 'http://example.com/', allowAbsoluteUrls: false});
client.get('http://evil.com');

Remediation

Upgrade axios to version 0.30.0, 1.8.2 or higher.

References

medium severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: axios
  • Introduced through: axios@0.21.4

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 axios@0.21.4
    Remediation: Upgrade to axios@0.30.0.

Overview

axios is a promise-based HTTP client for the browser and Node.js.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) due to not setting allowAbsoluteUrls to false by default when processing a requested URL in buildFullPath(). It may not be obvious that this value is being used with the less safe default, and URLs that are expected to be blocked may be accepted. This is a bypass of the fix for the vulnerability described in CVE-2025-27152.

Remediation

Upgrade axios to version 0.30.0, 1.8.3 or higher.

References

medium severity

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: glob@7.2.3, firebase-tools@9.23.3 and others

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 exegesis@2.5.7 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 node-gyp@7.1.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 sass-graph@2.2.5 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 true-case-path@1.0.3 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 archiver@5.3.2 archiver-utils@2.1.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 exegesis-express@2.0.1 exegesis@2.5.7 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 node-gyp@7.1.2 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-wick@4.0.3 node-pre-gyp@0.12.0 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 wick-downloader@0.3.4 node-pre-gyp@0.14.0 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 cacache@15.3.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 npm-packlist@2.2.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 gaze@1.1.3 globule@1.3.4 glob@7.1.7 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 archiver@5.3.2 zip-stream@4.1.1 archiver-utils@3.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 cacache@15.3.0 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 unzipper@0.10.14 fstream@1.0.12 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 @npmcli/run-script@1.8.6 node-gyp@7.1.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 restify@8.6.1 bunyan@1.8.15 mv@2.1.1 rimraf@2.4.5 glob@6.0.4 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 @npmcli/run-script@1.8.6 node-gyp@7.1.2 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 cacache@15.3.0 @npmcli/move-file@1.1.2 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 npm-registry-fetch@11.0.0 make-fetch-happen@9.1.0 cacache@15.3.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 npm-registry-fetch@11.0.0 make-fetch-happen@9.1.0 cacache@15.3.0 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-filesize@9.1.2 pacote@11.3.5 npm-registry-fetch@11.0.0 make-fetch-happen@9.1.0 cacache@15.3.0 @npmcli/move-file@1.1.2 rimraf@3.0.2 glob@7.2.3 inflight@1.0.6

…and 24 more

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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: marked
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 marked@0.7.0
    Remediation: Upgrade to firebase-tools@10.1.2.

Overview

marked is a low-level compiler for parsing markdown without caching or blocking for long periods of time.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). The em regex within src/rules.js file have multiple unused capture groups which could lead to a denial of service attack if user input is reachable.

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 marked to version 1.1.1 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: json-ptr
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 exegesis@2.5.7 json-ptr@2.2.0
    Remediation: Upgrade to firebase-tools@10.1.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 exegesis-express@2.0.1 exegesis@2.5.7 json-ptr@2.2.0
    Remediation: Upgrade to firebase-tools@10.1.0.

Overview

json-ptr is a complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.

Affected versions of this package are vulnerable to Prototype Pollution. A type confusion vulnerability can lead to a bypass of CVE-2020-7766 when the user-provided keys used in the pointer parameter are arrays.

PoC

const { JsonPointer } = require("json-ptr");

// JsonPointer.set({}, ['__proto__', 'polluted'], 'yes', true); 
// console.log(polluted); // Error: Attempted prototype pollution disallowed.

JsonPointer.set({}, [['__proto__'], 'polluted'], 'yes', true); 
console.log(polluted); // yes

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 json-ptr to version 3.0.0 or higher.

References

medium severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: node-forge
  • Introduced through: firebase-admin@9.12.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 node-forge@0.10.0
    Remediation: Upgrade to firebase-admin@10.0.2.

Overview

node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature due to RSA's PKCS#1 v1.5 signature verification code which does not properly check DigestInfo for a proper ASN.1 structure. This can lead to successful verification with signatures that contain invalid structures but a valid digest.

Remediation

Upgrade node-forge to version 1.3.0 or higher.

References

medium severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: node-forge
  • Introduced through: firebase-admin@9.12.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 node-forge@0.10.0
    Remediation: Upgrade to firebase-admin@10.0.2.

Overview

node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature due to RSAs PKCS#1` v1.5 signature verification code which is lenient in checking the digest algorithm structure. This can allow a crafted structure that steals padding bytes and uses unchecked portion of the PKCS#1 encoded message to forge a signature when a low public exponent is being used.

Remediation

Upgrade node-forge to version 1.3.0 or higher.

References

medium severity

Open Redirect

  • Vulnerable module: got
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 update-notifier@5.1.0 latest-version@5.1.0 package-json@6.5.0 got@9.6.0
    Remediation: Upgrade to firebase-tools@11.21.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 superstatic@7.1.0 update-notifier@4.1.3 latest-version@5.1.0 package-json@6.5.0 got@9.6.0
    Remediation: Upgrade to firebase-tools@11.14.0.

Overview

Affected versions of this package are vulnerable to Open Redirect due to missing verification of requested URLs. It allowed a victim to be redirected to a UNIX socket.

Remediation

Upgrade got to version 11.8.5, 12.1.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: axios
  • Introduced through: axios@0.21.4

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 axios@0.21.4
    Remediation: Upgrade to axios@0.29.0.

Overview

axios is a promise-based HTTP client for the browser and Node.js.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). An attacker can deplete system resources by providing a manipulated string as input to the format method, causing the regular expression to exhibit a time complexity of O(n^2). This makes the server to become unable to provide normal service due to the excessive cost and time wasted in processing vulnerable regular expressions.

PoC

const axios = require('axios');

console.time('t1');
axios.defaults.baseURL = '/'.repeat(10000) + 'a/';
axios.get('/a').then(()=>{}).catch(()=>{});
console.timeEnd('t1');

console.time('t2');
axios.defaults.baseURL = '/'.repeat(100000) + 'a/';
axios.get('/a').then(()=>{}).catch(()=>{});
console.timeEnd('t2');


/* stdout
t1: 60.826ms
t2: 5.826s
*/

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 axios to version 0.29.0, 1.6.3 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: loader-utils
  • Introduced through: rollup-plugin-vue@4.7.2

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 generic-names@1.0.3 loader-utils@0.2.17

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the resourcePath variable in interpolateName.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 loader-utils to version 1.4.2, 2.0.4, 3.2.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: loader-utils
  • Introduced through: rollup-plugin-vue@4.7.2

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 generic-names@1.0.3 loader-utils@0.2.17

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in interpolateName function via the URL variable.

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 loader-utils to version 1.4.2, 2.0.4, 3.2.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: lodash-es
  • Introduced through: rete-context-menu-plugin@0.6.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rete-context-menu-plugin@0.6.0 lodash-es@4.17.15
    Remediation: Upgrade to rete-context-menu-plugin@2.0.0.

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the toNumber, trim and trimEnd functions.

POC

var lo = require('lodash');

function build_blank (n) {
var ret = "1"
for (var i = 0; i < n; i++) {
ret += " "
}

return ret + "1";
}

var s = build_blank(50000)
var time0 = Date.now();
lo.trim(s)
var time_cost0 = Date.now() - time0;
console.log("time_cost0: " + time_cost0)

var time1 = Date.now();
lo.toNumber(s)
var time_cost1 = Date.now() - time1;
console.log("time_cost1: " + time_cost1)

var time2 = Date.now();
lo.trimEnd(s)
var time_cost2 = Date.now() - time2;
console.log("time_cost2: " + time_cost2)

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 lodash-es to version 4.17.21 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: marked
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 marked@0.7.0
    Remediation: Upgrade to firebase-tools@10.1.2.

Overview

marked is a low-level compiler for parsing markdown without caching or blocking for long periods of time.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when passing unsanitized user input to inline.reflinkSearch, if it is not being parsed by a time-limited worker thread.

PoC

import * as marked from 'marked';

console.log(marked.parse(`[x]: x

\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](`));

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 marked to version 4.0.10 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: marked
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3 marked@0.7.0
    Remediation: Upgrade to firebase-tools@10.1.2.

Overview

marked is a low-level compiler for parsing markdown without caching or blocking for long periods of time.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when unsanitized user input is passed to block.def.

PoC

import * as marked from "marked";
marked.parse(`[x]:${' '.repeat(1500)}x ${' '.repeat(1500)} x`);

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 marked to version 4.0.10 or higher.

References

medium severity

Open Redirect

  • Vulnerable module: node-forge
  • Introduced through: firebase-admin@9.12.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 node-forge@0.10.0
    Remediation: Upgrade to firebase-admin@10.0.2.

Overview

node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.

Affected versions of this package are vulnerable to Open Redirect via parseUrl function when it mishandles certain uses of backslash such as https:/\/\/\ and interprets the URI as a relative path.

PoC:


// poc.js
var forge = require("node-forge");
var url = forge.util.parseUrl("https:/\/\/\www.github.com/foo/bar");
console.log(url);

// Output of node poc.js:

{
  full: 'https://',
  scheme: 'https',
  host: '',
  port: 443,
  path: '/www.github.com/foo/bar',                        <<<---- path  should be "/foo/bar"
  fullHost: ''
}

Remediation

Upgrade node-forge to version 1.0.0 or higher.

References

medium severity

Improper Certificate Validation

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0
    Remediation: Upgrade to node-sass@7.0.0.

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to Improper Certificate Validation. Certificate validation is disabled by default when requesting binaries, even if the user is not specifying an alternative download path.

Remediation

Upgrade node-sass to version 7.0.0 or higher.

References

medium severity

Improper Input Validation

  • Vulnerable module: postcss
  • Introduced through: rollup-plugin-vue@4.7.2

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler-utils@2.6.0 postcss@7.0.39
    Remediation: Upgrade to rollup-plugin-vue@5.0.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 @vue/component-compiler-utils@2.6.0 postcss@7.0.39
    Remediation: Upgrade to rollup-plugin-vue@5.0.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 postcss@5.2.18
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 postcss-modules-local-by-default@1.2.0 postcss@6.0.23
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 postcss-modules-scope@1.1.0 postcss@6.0.23

…and 2 more

Overview

postcss is a PostCSS is a tool for transforming styles with JS plugins.

Affected versions of this package are vulnerable to Improper Input Validation when parsing external Cascading Style Sheets (CSS) with linters using PostCSS. An attacker can cause discrepancies by injecting malicious CSS rules, such as @font-face{ font:(\r/*);}. This vulnerability is because of an insecure regular expression usage in the RE_BAD_BRACKET variable.

Remediation

Upgrade postcss to version 8.4.31 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: postcss
  • Introduced through: rollup-plugin-vue@4.7.2

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 postcss@5.2.18
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 postcss-modules-local-by-default@1.2.0 postcss@6.0.23
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rollup-plugin-vue@4.7.2 @vue/component-compiler@3.6.0 postcss-modules-sync@1.0.0 postcss-modules-scope@1.1.0 postcss@6.0.23

Overview

postcss is a PostCSS is a tool for transforming styles with JS plugins.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via getAnnotationURL() and loadAnnotation() in lib/previous-map.js. The vulnerable regexes are caused mainly by the sub-pattern \/\*\s*# sourceMappingURL=(.*).

PoC

var postcss = require("postcss")
function build_attack(n) {
    var ret = "a{}"
    for (var i = 0; i < n; i++) {
        ret += "/*# sourceMappingURL="
    }
    return ret + "!";
}

// postcss.parse('a{}/*# sourceMappingURL=a.css.map */')
for(var i = 1; i <= 500000; i++) {
    if (i % 1000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
        try{
            postcss.parse(attack_str)
            var time_cost = Date.now() - time;
            console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
            }
        catch(e){
        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 postcss to version 8.2.13, 7.0.36 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: scss-tokenizer
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0 sass-graph@2.2.5 scss-tokenizer@0.2.3
    Remediation: Upgrade to node-sass@7.0.2.

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the loadAnnotation() function, due to the usage of insecure regex.

PoC

var scss = require("scss-tokenizer")
function build_attack(n) {
    var ret = "a{}"
    for (var i = 0; i < n; i++) {
        ret += "/*# sourceMappingURL="
    }
    return ret + "!";
}

// postcss.parse('a{}/*# sourceMappingURL=a.css.map */')
for(var i = 1; i <= 500000; i++) {
    if (i % 1000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
        try{
            scss.tokenize(attack_str)
            var time_cost = Date.now() - time;
            console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
            }
        catch(e){
        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 scss-tokenizer to version 0.4.3 or higher.

References

medium severity

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to NULL Pointer Dereference via Sass::Parser::parseCompoundSelectorin parser_selectors.cpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.

Remediation

There is no fixed version for node-sass.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to Out-of-bounds Read via Sass::weaveParents in ast_sel_weave.cpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.

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 node-sass.

References

medium severity

Uncontrolled Recursion

  • Vulnerable module: node-sass
  • Introduced through: node-sass@5.0.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 node-sass@5.0.0

Overview

node-sass is a Node.js bindings package for libsass.

Affected versions of this package are vulnerable to Uncontrolled Recursion via Sass::Eval::operator()(Sass::Binary_Expression*) in eval.cpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.

Details

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

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 node-sass.

References

medium severity

Insecure Storage of Sensitive Information

  • Vulnerable module: @google-cloud/firestore
  • Introduced through: firebase-admin@9.12.0

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-admin@9.12.0 @google-cloud/firestore@4.15.1
    Remediation: Upgrade to firebase-admin@11.1.0.

Overview

@google-cloud/firestore is a Firestore Client Library for Node.js

Affected versions of this package are vulnerable to Insecure Storage of Sensitive Information. An attacker with logs read access can potentially read sensitive information exposed by developers that log objects through this._settings, which could inadvertently log the firestore key.

Remediation

Upgrade @google-cloud/firestore to version 6.2.0 or higher.

References

low severity

Cross-Site Request Forgery (CSRF)

  • Vulnerable module: firebase-tools
  • Introduced through: firebase-tools@9.23.3

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 firebase-tools@9.23.3
    Remediation: Upgrade to firebase-tools@13.6.1.

Overview

firebase-tools is a Command-Line Interface for Firebase

Affected versions of this package are vulnerable to Cross-Site Request Forgery (CSRF) via the export endpoint. An attacker can issue calls against localhost on the affected application by convincing a user to visit a malicious page using the emulator, and extract information from the application.

Remediation

Upgrade firebase-tools to version 13.6.1 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: @vue/compiler-sfc
  • Introduced through: vue@2.7.16 and rete-vue-render-plugin@0.5.2

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 vue@2.7.16 @vue/compiler-sfc@2.7.16
    Remediation: Upgrade to vue@3.0.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rete-vue-render-plugin@0.5.2 vue@2.7.16 @vue/compiler-sfc@2.7.16

Overview

@vue/compiler-sfc is a @vue/compiler-sfc

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) through the parseHTML function in html-parser.ts. An attacker can cause the application to consume excessive resources by supplying a specially crafted input that triggers inefficient regular expression evaluation.

PoC

Within Vue 2 client-side application code, create a new Vue instance with a template string that includes a <script> node tag that has a different closing tag (in this case </textarea>).

new Vue({
  el: '#app',
  template: '
<div> 
   Hello, world!
   <script>${'<'.repeat(1000000)}</textarea>
</div>'
});

Set up an index.html file that loads the above JavaScript and then mount the newly created Vue instance with mount().

<!DOCTYPE html>
<html>
<head>
  <title>My first Vue app</title>
</head>
<body>
  <div id="app">
    Loading..
  </div>
</body>
</html>

In a browser, visit your Vue application

http://localhost:3000

In the browser, observe how the ReDoS vulnerability is able to increase the amount of time it takes for the page to parse the template and mount your Vue application. This demonstrates the ReDoS vulnerability.

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 @vue/compiler-sfc to version 3.0.0-alpha.0 or higher.

References

low severity

Cross-site Scripting

  • Vulnerable module: send
  • Introduced through: restify@8.6.1

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 restify@8.6.1 send@0.16.2

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

A cross-site scripting attack occurs when the attacker tricks a legitimate web-based application or site to accept a request as originating from a trusted source.

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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: vue
  • Introduced through: rete-context-menu-plugin@0.6.0, vue@2.7.16 and others

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rete-context-menu-plugin@0.6.0 vue@2.5.17
    Remediation: Upgrade to rete-context-menu-plugin@2.0.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 vue@2.7.16
    Remediation: Upgrade to vue@3.0.0.
  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 rete-vue-render-plugin@0.5.2 vue@2.7.16

Overview

vue is an open source project with its ongoing development made possible entirely by the support of these awesome backers.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) through the parseHTML function in html-parser.ts. An attacker can cause the application to consume excessive resources by supplying a specially crafted input that triggers inefficient regular expression evaluation.

PoC

Within Vue 2 client-side application code, create a new Vue instance with a template string that includes a <script> node tag that has a different closing tag (in this case </textarea>).

new Vue({
  el: '#app',
  template: '
<div> 
   Hello, world!
   <script>${'<'.repeat(1000000)}</textarea>
</div>'
});

Set up an index.html file that loads the above JavaScript and then mount the newly created Vue instance with mount().

<!DOCTYPE html>
<html>
<head>
  <title>My first Vue app</title>
</head>
<body>
  <div id="app">
    Loading..
  </div>
</body>
</html>

In a browser, visit your Vue application

http://localhost:3000

In the browser, observe how the ReDoS vulnerability is able to increase the amount of time it takes for the page to parse the template and mount your Vue application. This demonstrates the ReDoS vulnerability.

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 vue to version 3.0.0-alpha.0 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: vue-template-compiler
  • Introduced through: vue-template-compiler@2.7.16

Detailed paths

  • Introduced through: dev-xp@RayBenefield/dev-xp#c233c87daf6232fa74b867a79210b217bae2cc32 vue-template-compiler@2.7.16

Overview

vue-template-compiler is a template compiler for Vue 2.0

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) through the parseHTML function in html-parser.ts. An attacker can cause the application to consume excessive resources by supplying a specially crafted input that triggers inefficient regular expression evaluation.

PoC

Within Vue 2 client-side application code, create a new Vue instance with a template string that includes a <script> node tag that has a different closing tag (in this case </textarea>).

new Vue({
  el: '#app',
  template: '
<div> 
   Hello, world!
   <script>${'<'.repeat(1000000)}</textarea>
</div>'
});

Set up an index.html file that loads the above JavaScript and then mount the newly created Vue instance with mount().

<!DOCTYPE html>
<html>
<head>
  <title>My first Vue app</title>
</head>
<body>
  <div id="app">
    Loading..
  </div>
</body>
</html>

In a browser, visit your Vue application

http://localhost:3000

In the browser, observe how the ReDoS vulnerability is able to increase the amount of time it takes for the page to parse the template and mount your Vue application. This demonstrates the ReDoS vulnerability.

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 vue-template-compiler.

References