brigadehub@0.1.15

Vulnerabilities

77 via 476 paths

Dependencies

1371

Source

npm

Find, fix and prevent vulnerabilities in your code.

Severity
  • 3
  • 32
  • 36
  • 6
Status
  • 77
  • 0
  • 0

critical severity

DLL Injection

  • Vulnerable module: kerberos
  • Introduced through: brigadehub-core@0.1.10

Detailed paths

  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 mongodb-collection-dump@0.2.1 mongodb@1.3.23 kerberos@0.0.3

Overview

Affected versions of this package are vulnerable to DLL Injection. An attacker can execute arbitrary code by creating a file with the same name in a folder that precedes the intended file in the DLL path search.

Remediation

Upgrade kerberos to version 1.0.0 or higher.

References

critical severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 lodash@4.16.6
    Remediation: Upgrade to express-validator@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 lodash@3.10.1

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution in zipObjectDeep due to an incomplete fix for CVE-2020-8203.

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

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

References

critical severity

Improper Integrity Checks

  • Vulnerable module: yarn
  • Introduced through: yarn@0.17.10, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 yarn@0.17.10
    Remediation: Upgrade to yarn@1.19.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 yarn@0.17.10
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 yarn@0.17.10

Overview

yarn is a package for dependency management.

Affected versions of this package are vulnerable to Improper Integrity Checks. It allows to pollute yarn cache via a crafted yarn.lock file and place a malicious package into cache under any name/version, bypassing both integrity and hash checks in yarn.lock so that any future installs of that package will install the fake version (regardless of integrity and hashes).

Remediation

Upgrade yarn to version 1.19 or higher.

References

high severity

Internal Property Tampering

  • Vulnerable module: bson
  • Introduced through: mongoose@4.13.21, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 mongoose@4.13.21 bson@1.0.9
    Remediation: Upgrade to mongoose@5.3.9.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 mongoose@4.13.21 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 mongoose@4.13.21 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 mongoose@4.13.21 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 connect-mongo@1.3.2 mongodb@2.2.36 mongodb-core@2.1.20 bson@1.0.9
    Remediation: Upgrade to connect-mongo@3.0.0.
  • Introduced through: brigadehub@0.1.15 db-migrate-mongodb@1.5.0 mongodb@2.2.36 mongodb-core@2.1.20 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 mongoose@4.13.21 mongodb@2.2.34 mongodb-core@2.1.18 bson@1.0.9
    Remediation: Upgrade to mongoose@5.2.9.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 connect-mongo@1.3.2 mongodb@2.2.36 mongodb-core@2.1.20 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 connect-mongo@1.3.2 mongodb@2.2.36 mongodb-core@2.1.20 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 connect-mongo@1.3.2 mongodb@2.2.36 mongodb-core@2.1.20 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 db-migrate-mongodb@1.5.0 mongodb@2.2.36 mongodb-core@2.1.20 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 db-migrate-mongodb@1.5.0 mongodb@2.2.36 mongodb-core@2.1.20 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 db-migrate-mongodb@1.5.0 mongodb@2.2.36 mongodb-core@2.1.20 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 mongoose@4.13.21 mongodb@2.2.34 mongodb-core@2.1.18 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 mongoose@4.13.21 mongodb@2.2.34 mongodb-core@2.1.18 bson@1.0.9
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 mongoose@4.13.21 mongodb@2.2.34 mongodb-core@2.1.18 bson@1.0.9

Overview

bson is a BSON Parser for node and browser.

Affected versions of this package are vulnerable to Internal Property Tampering. The package will ignore an unknown value for an object's _bsotype, leading to cases where an object is serialized as a document rather than the intended BSON type.

Remediation

Upgrade bson to version 1.1.4 or higher.

References

high severity

Authorization Bypass

  • Vulnerable module: express-jwt
  • Introduced through: brigadehub-core@0.1.10

Detailed paths

  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-jwt@5.3.3

Overview

express-jwt is a JWT authentication middleware.

Affected versions of this package are vulnerable to Authorization Bypass. The algorithms entry to be specified in the configuration is not being enforced. When algorithms is not specified in the configuration, with the combination of jwks-rsa, it may lead to authorization bypass.

Remediation

Upgrade express-jwt to version 6.0.0 or higher.

References

high severity

Command Injection

  • Vulnerable module: lodash
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 lodash@4.16.6
    Remediation: Upgrade to express-validator@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 lodash@3.10.1

Overview

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

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

PoC

var _ = require('lodash');

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

Remediation

Upgrade lodash to version 4.17.21 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 lodash@4.16.6
    Remediation: Upgrade to express-validator@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 lodash@3.10.1

Overview

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

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

PoC by Snyk

const mergeFn = require('lodash').defaultsDeep;
const payload = '{"constructor": {"prototype": {"a0": true}}}'

function check() {
    mergeFn({}, JSON.parse(payload));
    if (({})[`a0`] === true) {
        console.log(`Vulnerable to Prototype Pollution via ${payload}`);
    }
  }

check();

For more information, check out our blog post

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

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

References

high severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 lodash@4.16.6
    Remediation: Upgrade to express-validator@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 lodash@3.10.1

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution via the setWith and set functions.

PoC by awarau

  • Create a JS file with this contents:
    lod = require('lodash')
    lod.setWith({}, "__proto__[test]", "123")
    lod.set({}, "__proto__[test2]", "456")
    console.log(Object.prototype)
    
  • Execute it with node
  • Observe that test and test2 is now in the 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

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

References

high severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 lodash@4.16.6
    Remediation: Upgrade to express-validator@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 lodash@3.10.1

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution. The functions merge, mergeWith, and defaultsDeep could be tricked into adding or modifying properties of Object.prototype. This is due to an incomplete fix to CVE-2018-3721.

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

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

References

high severity

Command Injection

  • Vulnerable module: lodash.template
  • Introduced through: gulp@3.9.1, gulp-watch@4.3.11 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 gulp-util@3.0.8 lodash.template@3.6.2
  • Introduced through: brigadehub@0.1.15 gulp-watch@4.3.11 gulp-util@3.0.8 lodash.template@3.6.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 gulp-util@3.0.8 lodash.template@3.6.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 gulp-util@3.0.8 lodash.template@3.6.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 gulp-util@3.0.8 lodash.template@3.6.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 gulp-util@3.0.8 lodash.template@3.6.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 gulp-util@3.0.8 lodash.template@3.6.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-watch@4.3.11 gulp-util@3.0.8 lodash.template@3.6.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp-watch@4.3.11 gulp-util@3.0.8 lodash.template@3.6.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-watch@4.3.11 gulp-util@3.0.8 lodash.template@3.6.2

Overview

lodash.template is a The Lodash method _.template exported as a Node.js module.

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

PoC

var _ = require('lodash');

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

Remediation

There is no fixed version for lodash.template.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: minimatch
  • Introduced through: gulp@3.9.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 glob@4.5.3 minimatch@2.0.10
    Remediation: Upgrade to gulp@4.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 glob@4.5.3 minimatch@2.0.10
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 glob@4.5.3 minimatch@2.0.10
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 glob@4.5.3 minimatch@2.0.10
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 minimatch@0.2.14
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 glob@3.1.21 minimatch@0.2.14
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 minimatch@0.2.14
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 minimatch@0.2.14
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 minimatch@0.2.14
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 glob@3.1.21 minimatch@0.2.14
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 glob@3.1.21 minimatch@0.2.14
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 glob@3.1.21 minimatch@0.2.14

Overview

minimatch is a minimal matching utility.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via complicated and illegal regexes.

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

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: minimatch
  • Introduced through: gulp@3.9.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
    Remediation: Open PR to patch minimatch@2.0.10.
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 glob@4.5.3 minimatch@2.0.10
    Remediation: Upgrade to gulp@4.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
    Remediation: Open PR to patch minimatch@2.0.10.
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
    Remediation: Open PR to patch minimatch@2.0.10.
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
    Remediation: Open PR to patch minimatch@2.0.10.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 glob@4.5.3 minimatch@2.0.10
    Remediation: Open PR to patch minimatch@2.0.10.
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 glob@4.5.3 minimatch@2.0.10
    Remediation: Open PR to patch minimatch@2.0.10.
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 glob@4.5.3 minimatch@2.0.10
    Remediation: Open PR to patch minimatch@2.0.10.
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 minimatch@0.2.14
    Remediation: Open PR to patch minimatch@0.2.14.
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 glob@3.1.21 minimatch@0.2.14
    Remediation: Open PR to patch minimatch@0.2.14.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 minimatch@0.2.14
    Remediation: Open PR to patch minimatch@0.2.14.
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 minimatch@0.2.14
    Remediation: Open PR to patch minimatch@0.2.14.
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 minimatch@0.2.14
    Remediation: Open PR to patch minimatch@0.2.14.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 glob@3.1.21 minimatch@0.2.14
    Remediation: Open PR to patch minimatch@0.2.14.
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 glob@3.1.21 minimatch@0.2.14
    Remediation: Open PR to patch minimatch@0.2.14.
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 glob@3.1.21 minimatch@0.2.14
    Remediation: Open PR to patch minimatch@0.2.14.

Overview

minimatch is a minimal matching utility.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS).

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

References

high severity

Denial of Service (DoS)

  • Vulnerable module: mongodb
  • Introduced through: connect-mongo@1.3.2, db-migrate-mongodb@1.5.0 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 connect-mongo@1.3.2 mongodb@2.2.36
    Remediation: Upgrade to connect-mongo@3.0.0.
  • Introduced through: brigadehub@0.1.15 db-migrate-mongodb@1.5.0 mongodb@2.2.36
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 connect-mongo@1.3.2 mongodb@2.2.36
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 connect-mongo@1.3.2 mongodb@2.2.36
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 connect-mongo@1.3.2 mongodb@2.2.36
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 db-migrate-mongodb@1.5.0 mongodb@2.2.36
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 db-migrate-mongodb@1.5.0 mongodb@2.2.36
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 db-migrate-mongodb@1.5.0 mongodb@2.2.36
  • Introduced through: brigadehub@0.1.15 mongoose@4.13.21 mongodb@2.2.34
    Remediation: Upgrade to mongoose@5.4.10.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 mongoose@4.13.21 mongodb@2.2.34
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 mongoose@4.13.21 mongodb@2.2.34
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 mongoose@4.13.21 mongodb@2.2.34
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 mongodb-collection-dump@0.2.1 mongodb@1.3.23

Overview

mongodb is an official MongoDB driver for Node.js.

Affected versions of this package are vulnerable to Denial of Service (DoS). The package fails to properly catch an exception when a collection name is invalid and the DB does not exist, crashing the application.

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 mongodb to version 3.1.13 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: mquery
  • Introduced through: mongoose@4.13.21, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 mongoose@4.13.21 mquery@2.3.3
    Remediation: Upgrade to mongoose@5.11.7.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 mongoose@4.13.21 mquery@2.3.3
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 mongoose@4.13.21 mquery@2.3.3
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 mongoose@4.13.21 mquery@2.3.3

Overview

mquery is an Expressive query building for MongoDB

Affected versions of this package are vulnerable to Prototype Pollution via the merge function within lib/utils.js. Depending on if user input is provided, an attacker can overwrite and pollute the object prototype of a program.

PoC

   require('./env').getCollection(function(err, collection) {
      assert.ifError(err);
      col = collection;
      done();
    });
    var payload = JSON.parse('{"__proto__": {"polluted": "vulnerable"}}');
    var m = mquery(payload);
    console.log({}.polluted);
// The empty object {} will have a property called polluted which will print vulnerable

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

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 mquery to version 3.2.3 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: mquery
  • Introduced through: mongoose@4.13.21, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 mongoose@4.13.21 mquery@2.3.3
    Remediation: Upgrade to mongoose@5.12.3.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 mongoose@4.13.21 mquery@2.3.3
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 mongoose@4.13.21 mquery@2.3.3
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 mongoose@4.13.21 mquery@2.3.3

Overview

mquery is an Expressive query building for MongoDB

Affected versions of this package are vulnerable to Prototype Pollution via the mergeClone() function.

PoC by zhou, peng

mquery = require('mquery');
var malicious_payload = '{"__proto__":{"polluted":"HACKED"}}';
console.log('Before:', {}.polluted); // undefined
mquery.utils.mergeClone({}, JSON.parse(malicious_payload));
console.log('After:', {}.polluted); // HACKED

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

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 mquery to version 3.2.5 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Denial of Service (DoS). There are memory leaks triggered by deeply nested code, such as code with a long sequence of open parenthesis characters, leading to a remote denial of service attack. 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

Upgrade node-sass to version 4.4.0 or higher.

References

high severity

Improper Input Validation

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Improper Input Validation. There is an illegal address access in the Eval::operator function in eval.cpp. A crafted input will lead to a remote denial of service. 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

Upgrade node-sass to version 4.4.0 or higher.

References

high severity

Improper Input Validation

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Improper Input Validation. There is an illegal address access in ast.cpp. A crafted input will lead to a remote denial of service attack. 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

Upgrade node-sass to version 4.4.0 or higher.

References

high severity

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to NULL Pointer Dereference. An issue was discovered in LibSass through 3.5.4. A NULL pointer dereference was found in the function Sass::Inspect::operator which could be leveraged by an attacker to cause a denial of service (application crash) or possibly have unspecified other impact.

Remediation

Upgrade node-sass to version 4.11.0 or higher.

References

high severity

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to NULL Pointer Dereference via the function Sass::Expand::operator which could be leveraged by an attacker to 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

Upgrade node-sass to version 4.9.0 or higher.

References

high severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Out-of-bounds Read. An issue was discovered in LibSass through 3.5.4. An out-of-bounds read of a memory region was found in the function Sass::Prelexer::skip_over_scopes which could be leveraged by an attacker to disclose information or manipulated to read from unmapped memory causing a denial of service. node-sass is affected by this vulnerability due to its bundled usage of libsass.

Remediation

Upgrade node-sass to version 4.11.0 or higher.

References

high severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Out-of-bounds Read via the function Sass::Prelexer::exactly() which could be leveraged by an attacker to disclose information or manipulated to read from unmapped memory causing a denial of service. 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

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Out-of-bounds Read via lexer.hpp. A crafted input will lead to a remote denial of service attack. 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

Upgrade node-sass to version 4.4.0 or higher.

References

high severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Out-of-bounds Read. There is an illegal address access in Sass::Eval::operator() in eval.cpp, leading to a remote denial of service attack. NOTE: this is similar to CVE-2017-11555 but remains exploitable after the vendor's CVE-2017-11555 fix (available from GitHub after 2017-07-24). 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

Upgrade node-sass to version 4.4.0 or higher.

References

high severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Out-of-bounds Read. A heap-based buffer over-read exists in the function json_mkstream() in sass_context.cpp. A crafted input will lead to a remote denial of service attack. 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

Upgrade node-sass to version 4.4.0 or higher.

References

high severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Out-of-bounds Read via the function Sass::handle_error which could be leveraged by an attacker to disclose information or manipulated to read from unmapped memory causing a denial of service. 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

Uncontrolled Recursion

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Uncontrolled Recursion. There is a stack consumption vulnerability in the Parser::advanceToNextToken function in parser.cpp in LibSass 3.4.5. A crafted input may lead to remote denial of service. node-sass is affected by this vulnerability due to its bundled usage of libsass.

Remediation

Upgrade node-sass to version 4.8.0 or higher.

References

high severity

Uncontrolled Recursion

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Uncontrolled Recursion via the function Sass::Eval::operator() in eval.cpp. It will lead to a remote denial of service attack. 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

Upgrade node-sass to version 4.4.0 or higher.

References

high severity

Uncontrolled Recursion

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Uncontrolled Recursion. There is a stack consumption vulnerability in the lex function in parser.hpp (as used in sassc). A crafted input will lead to a remote denial of service. 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

Upgrade node-sass to version 4.4.0 or higher.

References

high severity

Use After Free

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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

Command Injection

  • Vulnerable module: nodemailer
  • Introduced through: nodemailer@2.7.2, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 nodemailer@2.7.2
    Remediation: Upgrade to nodemailer@6.4.16.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 nodemailer@2.7.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 nodemailer@2.7.2

Overview

nodemailer is an Easy as cake e-mail sending from your Node.js applications

Affected versions of this package are vulnerable to Command Injection. Use of crafted recipient email addresses may result in arbitrary command flag injection in sendmail transport for sending mails.

PoC

-bi@example.com (-bi Initialize the alias database.)
-d0.1a@example.com (The option -d0.1 prints the version of sendmail and the options it was compiled with.)
-Dfilename@example.com (Debug output ffile)

Remediation

Upgrade nodemailer to version 6.4.16 or higher.

References

high severity

Remote Code Execution (RCE)

  • Vulnerable module: pug
  • Introduced through: pug@2.0.4, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 pug@2.0.4
    Remediation: Upgrade to pug@3.0.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 pug@2.0.4
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 pug@2.0.4
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 pug@2.0.4

Overview

pug is an A clean, whitespace-sensitive template language for writing HTML

Affected versions of this package are vulnerable to Remote Code Execution (RCE). If a remote attacker was able to control the pretty option of the pug compiler, e.g. if you spread a user provided object such as the query parameters of a request into the pug template inputs, it was possible for them to achieve remote code execution on the node.js backend.

Remediation

Upgrade pug to version 3.0.1 or higher.

References

high severity
new

Denial of Service (DoS)

  • Vulnerable module: trim-newlines
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1 meow@3.7.0 trim-newlines@1.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 ava@0.17.0 meow@3.7.0 trim-newlines@1.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 ava@0.17.0 meow@3.7.0 trim-newlines@1.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 ava@0.17.0 meow@3.7.0 trim-newlines@1.0.0
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1 meow@3.7.0 trim-newlines@1.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1 meow@3.7.0 trim-newlines@1.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1 meow@3.7.0 trim-newlines@1.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1 meow@3.7.0 trim-newlines@1.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1 meow@3.7.0 trim-newlines@1.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1 meow@3.7.0 trim-newlines@1.0.0

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

Man-in-the-Middle (MitM)

  • Vulnerable module: yarn
  • Introduced through: yarn@0.17.10, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 yarn@0.17.10
    Remediation: Upgrade to yarn@1.17.3.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 yarn@0.17.10
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 yarn@0.17.10

Overview

yarn is a package for dependency management.

Affected versions of this package are vulnerable to Man-in-the-Middle (MitM). Npm credentials such as _authToken were found to be sent over clear text when processing scoped packages that are listed as resolved. This could allow a suitably positioned attacker to eavesdrop and compromise the sent credentials.

Remediation

Upgrade yarn to version 1.17.3 or higher.

References

medium severity
new

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: css-what
  • Introduced through: brigadehub-admin-c4sf@0.1.18

Detailed paths

  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 css-select@1.0.0 css-what@1.0.0

Overview

css-what is an a CSS selector parser

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via attribute parsing.

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 css-what to version 5.0.1 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: dot-prop
  • Introduced through: brigadehub-admin-c4sf@0.1.18, brigadehub-core@0.1.10 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 ava@0.17.0 update-notifier@1.0.3 configstore@2.1.0 dot-prop@3.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 ava@0.17.0 update-notifier@1.0.3 configstore@2.1.0 dot-prop@3.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 ava@0.17.0 update-notifier@1.0.3 configstore@2.1.0 dot-prop@3.0.0

Overview

dot-prop is a package to get, set, or delete a property from a nested object using a dot path.

Affected versions of this package are vulnerable to Prototype Pollution. It is possible for a user to modify the prototype of a base object.

PoC by aaron_costello

var dotProp = require("dot-prop")
const object = {};
console.log("Before " + object.b); //Undefined
dotProp.set(object, '__proto__.b', true);
console.log("After " + {}.b); //true

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 dot-prop to version 4.2.1, 5.1.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: glob-parent
  • Introduced through: gulp-watch@4.3.11, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 gulp-watch@4.3.11 chokidar@1.7.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 ava@0.17.0 chokidar@1.7.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 ava@0.17.0 chokidar@1.7.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 ava@0.17.0 chokidar@1.7.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-watch@4.3.11 chokidar@1.7.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp-watch@4.3.11 chokidar@1.7.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-watch@4.3.11 chokidar@1.7.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 gulp-watch@4.3.11 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 gulp-watch@4.3.11 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-watch@4.3.11 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp-watch@4.3.11 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-watch@4.3.11 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 ava@0.17.0 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 ava@0.17.0 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 ava@0.17.0 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-watch@4.3.11 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp-watch@4.3.11 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-watch@4.3.11 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 parse-glob@3.0.4 glob-base@0.3.0 glob-parent@2.0.0
  • Introduced through: brigadehub@0.1.15 gulp-watch@4.3.11 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-watch@4.3.11 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp-watch@4.3.11 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-watch@4.3.11 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 gulp-nodemon@2.5.0 gulp@4.0.2 glob-watcher@5.0.5 chokidar@2.1.8 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 gulp-nodemon@2.5.0 gulp@4.0.2 vinyl-fs@3.0.3 glob-stream@6.1.0 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-nodemon@2.5.0 gulp@4.0.2 glob-watcher@5.0.5 chokidar@2.1.8 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp-nodemon@2.5.0 gulp@4.0.2 glob-watcher@5.0.5 chokidar@2.1.8 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-nodemon@2.5.0 gulp@4.0.2 glob-watcher@5.0.5 chokidar@2.1.8 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-nodemon@2.5.0 gulp@4.0.2 vinyl-fs@3.0.3 glob-stream@6.1.0 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp-nodemon@2.5.0 gulp@4.0.2 vinyl-fs@3.0.3 glob-stream@6.1.0 glob-parent@3.1.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-nodemon@2.5.0 gulp@4.0.2 vinyl-fs@3.0.3 glob-stream@6.1.0 glob-parent@3.1.0

Overview

glob-parent is a package that helps extracting the non-magic parent path from a glob string.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). The enclosure regex used to check for strings ending in enclosure containing path separator.

PoC by Yeting Li

var globParent = require("glob-parent")
function build_attack(n) {
var ret = "{"
for (var i = 0; i < n; i++) {
ret += "/"
}

return ret;
}

globParent(build_attack(5000));

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 glob-parent to version 5.1.2 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: hoek
  • Introduced through: brigadehub-core@0.1.10

Detailed paths

  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 jsonwebtoken@7.4.3 joi@6.10.1 hoek@2.16.3
    Remediation: Open PR to patch hoek@2.16.3.
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 jsonwebtoken@7.4.3 joi@6.10.1 topo@1.1.0 hoek@2.16.3
    Remediation: Open PR to patch hoek@2.16.3.

Overview

hoek is an Utility methods for the hapi ecosystem.

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

PoC by Olivier Arteau (HoLyVieR)

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

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

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 hoek to version 4.2.1, 5.0.3 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 lodash@4.16.6
    Remediation: Upgrade to express-validator@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 lodash@4.16.6
    Remediation: Open PR to patch lodash@4.16.6.
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 lodash@4.16.6
    Remediation: Open PR to patch lodash@4.16.6.
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 lodash@4.16.6
    Remediation: Open PR to patch lodash@4.16.6.
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 lodash@3.10.1

Overview

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

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

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

References

medium severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 lodash@4.16.6
    Remediation: Upgrade to express-validator@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 lodash@3.10.1
    Remediation: Open PR to patch lodash@3.10.1.

Overview

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

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

PoC by Olivier Arteau (HoLyVieR)

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

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

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

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

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: lodash
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 lodash@4.16.6
    Remediation: Upgrade to express-validator@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 lodash@3.10.1

Overview

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

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

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: lodash
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 lodash@4.16.6
    Remediation: Upgrade to express-validator@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 lodash@4.16.6
  • Introduced through: brigadehub@0.1.15 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp@3.9.1 vinyl-fs@0.3.14 glob-watcher@0.0.6 gaze@0.5.2 globule@0.1.0 lodash@1.0.2
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 npm-module-search@1.0.1 cheerio@0.19.0 lodash@3.10.1

Overview

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

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). It parses dates using regex strings, which may cause a slowdown of 2 seconds per 50k characters.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade lodash to version 4.17.11 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: markdown-it
  • Introduced through: markdown-it@6.1.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 markdown-it@6.1.1
    Remediation: Upgrade to markdown-it@10.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 markdown-it@6.1.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 markdown-it@6.1.1

Overview

markdown-it is a modern pluggable markdown parser.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). Parsing __*_… takes quadratic time, this could be a denial of service vulnerability in an application that parses user input.

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 markdown-it to version 10.0.0 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: minimist
  • Introduced through: db-migrate@0.10.7, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 db-migrate@0.10.7 optimist@0.6.1 minimist@0.0.10
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 db-migrate@0.10.7 optimist@0.6.1 minimist@0.0.10
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 db-migrate@0.10.7 optimist@0.6.1 minimist@0.0.10
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 db-migrate@0.10.7 optimist@0.6.1 minimist@0.0.10

Overview

minimist is a parse argument options module.

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

PoC by Snyk

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

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

Details

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

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

  • Unsafe Object recursive merge
  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server
  • Web server

How to prevent

  1. Freeze the prototype— use Object.freeze (Object.prototype).
  2. Require schema validation of JSON input.
  3. Avoid using unsafe recursive merge functions.
  4. Consider using objects without prototypes (for example, Object.create(null)), breaking the prototype chain and preventing pollution.
  5. As a best practice use Map instead of Object.

For more information on this vulnerability type:

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

Remediation

Upgrade minimist to version 0.2.1, 1.2.3 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: mongoose
  • Introduced through: mongoose@4.13.21, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 mongoose@4.13.21
    Remediation: Upgrade to mongoose@5.12.2.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 mongoose@4.13.21
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 mongoose@4.13.21
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 mongoose@4.13.21

Overview

mongoose is a Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.

Affected versions of this package are vulnerable to Prototype Pollution. The mongoose.Schema() function is subject to prototype pollution due to the recursively calling of Schema.prototype.add() function to add new items into the schema object. This vulnerability allows modification of the Object prototype.

PoC

mongoose = require('mongoose');
mongoose.version; //'5.12.0'
var malicious_payload = '{"__proto__":{"polluted":"HACKED"}}';
console.log('Before:', {}.polluted); // undefined
mongoose.Schema(JSON.parse(malicious_payload));
console.log('After:', {}.polluted); // HACKED

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

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 mongoose to version 5.12.2 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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

Denial of Service (DoS)

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Denial of Service (DoS). The parsing component allows attackers to cause uncontrolled recursion in Sass::Parser::parse_css_variable_value in parser.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

Denial of Service (DoS)

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Denial of Service (DoS). Functions inside ast.cpp for IMPLEMENT_AST_OPERATORS expansion allow attackers to cause a denial-of-service resulting from stack consumption via a crafted sass file, as demonstrated by recursive calls involving clone(), cloneChildren(), and copy(). 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

Upgrade node-sass to version 4.11.0 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Denial of Service (DoS). Crafted objects passed to the renderSync function may trigger C++ assertions in CustomImporterBridge::get_importer_entry and CustomImporterBridge::post_process_return_value that crash the Node process. This may allow attackers to crash the system's running Node process and lead to Denial of Service.

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 node-sass to version 4.13.1 or higher.

References

medium severity

Improper Certificate Validation

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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

There is no fixed version for node-sass.

References

medium severity

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to NULL Pointer Dereference. In LibSass 3.5.5, a NULL Pointer Dereference in the function Sass::Eval::operator()``(Sass::Supports_Operator*) in eval.cpp may cause a Denial of Service (application crash) via a crafted sass input file.

Remediation

There is no fixed version for node-sass.

References

medium severity

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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.

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

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to NULL Pointer Dereference. The function Sass::Selector_List::populate_extends in SharedPtr.hpp (used by ast.cpp and ast_selectors.cpp) may cause a Denial of Service (application crash) via a crafted sass input 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

Out-of-Bounds

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Out-of-bounds Read. ]There is a heap-based buffer over-read in the Sass::Prelexer::re_linebreak function in lexer.cpp in LibSass 3.4.5. A crafted input will lead to a remote denial of service attack.

Remediation

Upgrade node-sass to version 4.2.0 or higher.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Out-of-bounds Read related to address 0xb4803ea1. A crafted input will lead to a remote denial of service attack. 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

Upgrade node-sass to version 4.3.0 or higher.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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::Prelexer::skip_over_scopes in prelexer.hpp when called from Sass::Parser::parse_import(), a similar issue to CVE-2018-11693. 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@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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

Resource Exhaustion

  • Vulnerable module: node-sass
  • Introduced through: node-sass-middleware@0.9.8, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
    Remediation: Upgrade to node-sass-middleware@0.10.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

Overview

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

Affected versions of this package are vulnerable to Resource Exhaustion. In LibSass prior to 3.5.5, Sass::Eval::operator()(Sass::Binary_Expression*) inside eval.cpp allows attackers to cause a denial-of-service resulting from stack consumption via a crafted sass file, because of certain incorrect parsing of '%' as a modulo operator in parser.cpp.

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 node-sass to version 4.11.0 or higher.

References

medium severity

Uncontrolled Recursion

  • Vulnerable module: node-sass
  • Introduced through: node-sass@4.14.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-sass@3.2.1 node-sass@4.14.1
  • Introduced through: brigadehub@0.1.15 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 node-sass-middleware@0.9.8 node-sass@3.13.1
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 node-sass-middleware@0.9.8 node-sass@3.13.1

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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: string
  • Introduced through: markdown-it-named-headers@0.0.4, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 markdown-it-named-headers@0.0.4 string@3.3.3
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 markdown-it-named-headers@0.0.4 string@3.3.3
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 markdown-it-named-headers@0.0.4 string@3.3.3

Overview

string is a JavaScript library for extra String methods.

Affected versions of this package are vulnerable to Regular expression Denial of Service (ReDoS). It uses regex in the underscore and unescapeHTML methods, which can cause a slowdown of 2 seconds 50k characters.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

There is no fix version for string.

References

medium severity

Information Exposure

  • Vulnerable module: superagent
  • Introduced through: supertest@2.0.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 supertest@2.0.1 superagent@2.3.0
    Remediation: Upgrade to supertest@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 supertest@2.0.1 superagent@2.3.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 supertest@2.0.1 superagent@2.3.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 supertest@2.0.1 superagent@2.3.0

Overview

superagent is a Small progressive client-side HTTP request library, and Node.js module with the same API, supporting many high-level HTTP client features.

Affected versions of this package are vulnerable to Information Exposure due to sending the contents of Authorization to third parties.

Remediation

Upgrade superagent to version 3.8.1 or higher.

References

medium severity

Arbitrary Code Injection

  • Vulnerable module: underscore
  • Introduced through: nodemailer@2.7.2, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 nodemailer@2.7.2 nodemailer-direct-transport@3.3.2 smtp-connection@2.12.0 httpntlm@1.6.1 underscore@1.7.0
  • Introduced through: brigadehub@0.1.15 nodemailer@2.7.2 nodemailer-smtp-pool@2.8.2 smtp-connection@2.12.0 httpntlm@1.6.1 underscore@1.7.0
  • Introduced through: brigadehub@0.1.15 nodemailer@2.7.2 nodemailer-smtp-transport@2.7.2 smtp-connection@2.12.0 httpntlm@1.6.1 underscore@1.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 nodemailer@2.7.2 nodemailer-direct-transport@3.3.2 smtp-connection@2.12.0 httpntlm@1.6.1 underscore@1.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 nodemailer@2.7.2 nodemailer-direct-transport@3.3.2 smtp-connection@2.12.0 httpntlm@1.6.1 underscore@1.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 nodemailer@2.7.2 nodemailer-smtp-pool@2.8.2 smtp-connection@2.12.0 httpntlm@1.6.1 underscore@1.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 nodemailer@2.7.2 nodemailer-smtp-pool@2.8.2 smtp-connection@2.12.0 httpntlm@1.6.1 underscore@1.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 nodemailer@2.7.2 nodemailer-smtp-transport@2.7.2 smtp-connection@2.12.0 httpntlm@1.6.1 underscore@1.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 nodemailer@2.7.2 nodemailer-smtp-transport@2.7.2 smtp-connection@2.12.0 httpntlm@1.6.1 underscore@1.7.0

Overview

underscore is a JavaScript's functional programming helper library.

Affected versions of this package are vulnerable to Arbitrary Code Injection via the template function, particularly when the variable option is taken from _.templateSettings as it is not sanitized.

PoC

const _ = require('underscore');
_.templateSettings.variable = "a = this.process.mainModule.require('child_process').execSync('touch HELLO')";
const t = _.template("")();

Remediation

Upgrade underscore to version 1.13.0-2, 1.12.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: validator
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 validator@5.7.0
    Remediation: Upgrade to express-validator@6.5.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 validator@5.7.0

Overview

validator is an A library of string validators and sanitizers.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the isSlug function

PoC

var validator = require("validator")
function build_attack(n) {
    var ret = "111"
    for (var i = 0; i < n; i++) {
        ret += "a"
    }

    return ret+"_";
}
for(var i = 1; i <= 50000; i++) {
    if (i % 10000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
       validator.isSlug(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 validator to version 13.6.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: validator
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 validator@5.7.0
    Remediation: Upgrade to express-validator@6.5.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 validator@5.7.0

Overview

validator is an A library of string validators and sanitizers.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the rtrim function.

PoC

var validator = require("validator")
function build_attack(n) {
    var ret = ""
    for (var i = 0; i < n; i++) {
        ret += " "
    }

    return ret+"◎";
}
for(var i = 1; i <= 50000; i++) {
    if (i % 10000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
       validator.rtrim(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 validator to version 13.6.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: validator
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 validator@5.7.0
    Remediation: Upgrade to express-validator@6.5.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 validator@5.7.0

Overview

validator is an A library of string validators and sanitizers.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the isHSL function.

PoC

var validator = require("validator")
function build_attack(n) {
    var ret = "hsla(0"
    for (var i = 0; i < n; i++) {
        ret += " "
    }

    return ret+"◎";
}
for(var i = 1; i <= 50000; i++) {
    if (i % 1000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
       validator.isHSL(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 validator to version 13.6.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: validator
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 validator@5.7.0
    Remediation: Upgrade to express-validator@6.5.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 validator@5.7.0

Overview

validator is an A library of string validators and sanitizers.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the isEmail function.

PoC

var validator = require("validator")
function build_attack(n) {
    var ret = ""
    for (var i = 0; i < n; i++) {
        ret += "<"
    }

    return ret+"";
}
for(var i = 1; i <= 50000; i++) {
    if (i % 10000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
        validator.isEmail(attack_str,{ allow_display_name: true })
        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 validator to version 13.6.0 or higher.

References

medium severity

Arbitrary File Overwrite

  • Vulnerable module: yarn
  • Introduced through: yarn@0.17.10, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 yarn@0.17.10
    Remediation: Upgrade to yarn@1.22.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 yarn@0.17.10
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 yarn@0.17.10

Overview

yarn is a package for dependency management.

Affected versions of this package are vulnerable to Arbitrary File Overwrite. It is possible for a malicious package, upon install, to write to any path on the filesystem even when the --ignore-scripts option is set. This occurs due to symlinks not being correctly unpacked as part of the Yarn install process.

Details

A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.

Directory Traversal vulnerabilities can be generally divided into two types:

  • Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.

st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.

If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.

curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa

Note %2e is the URL encoded version of . (dot).

  • Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as Zip-Slip.

One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.

The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:

2018-04-15 22:04:29 .....           19           19  good.txt
2018-04-15 22:04:42 .....           20           20  ../../../../../../root/.ssh/authorized_keys

Remediation

Upgrade yarn to version 1.22.0 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: braces
  • Introduced through: gulp-watch@4.3.11, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 gulp-watch@4.3.11 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
  • Introduced through: brigadehub@0.1.15 gulp-watch@4.3.11 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
    Remediation: Upgrade to gulp-watch@5.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-watch@4.3.11 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp-watch@4.3.11 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-watch@4.3.11 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 ava@0.17.0 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 ava@0.17.0 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 ava@0.17.0 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 gulp-watch@4.3.11 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 gulp-watch@4.3.11 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 gulp-watch@4.3.11 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5

Overview

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

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

Disclosure Timeline

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade braces to version 2.3.1 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: ms
  • Introduced through: brigadehub-admin-c4sf@0.1.18, brigadehub-core@0.1.10 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 ava@0.17.0 ms@0.7.3
    Remediation: Open PR to patch ms@0.7.3.
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 ava@0.17.0 ms@0.7.3
    Remediation: Open PR to patch ms@0.7.3.
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 ava@0.17.0 ms@0.7.3
    Remediation: Open PR to patch ms@0.7.3.

Overview

ms is a tiny millisecond conversion utility.

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

Proof of concept

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

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

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

Disclosure Timeline

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade ms to version 2.0.0 or higher.

References

low severity

Denial of Service (DoS)

  • Vulnerable module: superagent
  • Introduced through: supertest@2.0.1, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 supertest@2.0.1 superagent@2.3.0
    Remediation: Upgrade to supertest@3.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 supertest@2.0.1 superagent@2.3.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 supertest@2.0.1 superagent@2.3.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 supertest@2.0.1 superagent@2.3.0

Overview

superagent is a Small progressive client-side HTTP request library, and Node.js module with the same API, supporting many high-level HTTP client features.

Affected versions of this package are vulnerable to Denial of Service (DoS). It uncompresses responses in memory, and a malicious user may send a specially crafted zip file which will then unzip in the server and cause excessive CPU consumption. This is also known as a Zip Bomb.

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 superagent to version 3.7.0 or higher.

References

low severity

Uninitialized Memory Exposure

  • Vulnerable module: utile
  • Introduced through: db-migrate@0.10.7, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 db-migrate@0.10.7 prompt@1.1.0 utile@0.3.0
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 db-migrate@0.10.7 prompt@1.1.0 utile@0.3.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 db-migrate@0.10.7 prompt@1.1.0 utile@0.3.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 db-migrate@0.10.7 prompt@1.1.0 utile@0.3.0

Overview

utile is a drop-in replacement for util with some additional advantageous functions.

Affected versions of this package are vulnerable to Uninitialized Memory Exposure. A malicious user could extract sensitive data from uninitialized memory or to cause a DoS by passing in a large number, in setups where typed user input can be passed.

Note Uninitialized Memory Exposure impacts only Node.js 6.x or lower, Denial of Service impacts any Node.js version.

Details

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

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

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

Remediation

There is no fix version for utile.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: validator
  • Introduced through: express-validator@2.21.0, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 express-validator@2.21.0 validator@5.7.0
    Remediation: Upgrade to express-validator@5.0.0.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-core@0.1.10 express-validator@2.21.0 validator@5.7.0
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 express-validator@2.21.0 validator@5.7.0

Overview

validator is an A library of string validators and sanitizers.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). It used a regular expression (^\s*data:([a-z]+\/[a-z0-9\-\+]+(;[a-z\-]+=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9!\$&',\(\)\*\+,;=\-\._~:@\/\?%\s]*\s*$) in order to validate Data URIs. This can cause an impact of about 10 seconds matching time for data 70K characters long.

Disclosure Timeline

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade validator to version 9.4.1 or higher.

References

low severity

Arbitrary File Write

  • Vulnerable module: yarn
  • Introduced through: yarn@0.17.10, brigadehub-admin-c4sf@0.1.18 and others

Detailed paths

  • Introduced through: brigadehub@0.1.15 yarn@0.17.10
    Remediation: Upgrade to yarn@1.21.1.
  • Introduced through: brigadehub@0.1.15 brigadehub-admin-c4sf@0.1.18 yarn@0.17.10
  • Introduced through: brigadehub@0.1.15 brigadehub-public-c4sf@0.3.19 yarn@0.17.10

Overview

yarn is a package for dependency management.

Affected versions of this package are vulnerable to Arbitrary File Write. The package install functionality can be abused to generate arbitrary symlinks on the host filesystem by using specially crafted bin keys. Existing files could be overwritten depending on the current user permission set.

Details

A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.

Directory Traversal vulnerabilities can be generally divided into two types:

  • Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.

st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.

If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.

curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa

Note %2e is the URL encoded version of . (dot).

  • Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as Zip-Slip.

One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.

The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:

2018-04-15 22:04:29 .....           19           19  good.txt
2018-04-15 22:04:42 .....           20           20  ../../../../../../root/.ssh/authorized_keys

Remediation

Upgrade yarn to version 1.21.1 or higher.

References