Vulnerabilities

40 via 135 paths

Dependencies

872

Source

GitHub

Commit

d42e133b

Find, fix and prevent vulnerabilities in your code.

Issue type
  • 40
  • 1
Severity
  • 2
  • 16
  • 21
  • 2
Status
  • 41
  • 0
  • 0

critical severity

Heap-based Buffer Overflow

  • Vulnerable module: sharp
  • Introduced through: sharp@0.29.3

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 sharp@0.29.3
    Remediation: Upgrade to sharp@0.32.6.

Overview

sharp is a High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images

Affected versions of this package are vulnerable to Heap-based Buffer Overflow when the ReadHuffmanCodes() function is used. An attacker can craft a special WebP lossless file that triggers the ReadHuffmanCodes() function to allocate the HuffmanCode buffer with a size that comes from an array of precomputed sizes: kTableSize. The color_cache_bits value defines which size to use. The kTableSize array only takes into account sizes for 8-bit first-level table lookups but not second-level table lookups. libwebp allows codes that are up to 15-bit (MAX_ALLOWED_CODE_LENGTH). When BuildHuffmanTable() attempts to fill the second-level tables it may write data out-of-bounds. The OOB write to the undersized array happens in ReplicateValue.

Notes:

This is only exploitable if the color_cache_bits value defines which size to use.

This vulnerability was also published on libwebp CVE-2023-5129

Changelog:

2023-09-12: Initial advisory publication

2023-09-27: Advisory details updated, including CVSS, references

2023-09-27: CVE-2023-5129 rejected as a duplicate of CVE-2023-4863

2023-09-28: Research and addition of additional affected libraries

2024-01-28: Additional fix information

Remediation

Upgrade sharp to version 0.32.6 or higher.

References

critical severity

Uncaught Exception

  • Vulnerable module: multer
  • Introduced through: multer@1.4.4

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 multer@1.4.4
    Remediation: Upgrade to multer@2.0.1.

Overview

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

Remediation

Upgrade multer to version 2.0.1 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: cross-spawn
  • Introduced through: imagemin-optipng@8.0.0 and imagemin-mozjpeg@9.0.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 exec-buffer@3.2.0 execa@0.7.0 cross-spawn@5.1.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-build@3.0.0 execa@0.7.0 cross-spawn@5.1.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-build@3.0.0 execa@0.7.0 cross-spawn@5.1.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 bin-check@4.1.0 execa@0.7.0 cross-spawn@5.1.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 bin-check@4.1.0 execa@0.7.0 cross-spawn@5.1.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

Improper Neutralization of Special Elements in Data Query Logic

  • Vulnerable module: mongoose
  • Introduced through: mongoose@5.13.23

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mongoose@5.13.23
    Remediation: Upgrade to mongoose@6.13.5.

Overview

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

Affected versions of this package are vulnerable to Improper Neutralization of Special Elements in Data Query Logic due to the improper handling of $where in match queries. An attacker can manipulate search queries to inject malicious code.

Remediation

Upgrade mongoose to version 6.13.5, 7.8.3, 8.8.3 or higher.

References

high severity

Improper Neutralization of Special Elements in Data Query Logic

  • Vulnerable module: mongoose
  • Introduced through: mongoose@5.13.23

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mongoose@5.13.23
    Remediation: Upgrade to mongoose@6.13.6.

Overview

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

Affected versions of this package are vulnerable to Improper Neutralization of Special Elements in Data Query Logic due to the improper use of a $where filter in conjunction with the populate() match. An attacker can manipulate search queries to retrieve or alter information without proper authorization by injecting malicious input into the query.

Note: This vulnerability derives from an incomplete fix of CVE-2024-53900

Remediation

Upgrade mongoose to version 6.13.6, 7.8.4, 8.9.5 or higher.

References

high severity

Missing Release of Memory after Effective Lifetime

  • Vulnerable module: multer
  • Introduced through: multer@1.4.4

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 multer@1.4.4
    Remediation: Upgrade to multer@2.0.0.

Overview

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

Note:

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

Remediation

Upgrade multer to version 2.0.0 or higher.

References

high severity

Uncaught Exception

  • Vulnerable module: multer
  • Introduced through: multer@1.4.4

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 multer@1.4.4
    Remediation: Upgrade to multer@2.0.0.

Overview

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

PoC

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

const app = express()

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

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

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

Remediation

Upgrade multer to version 2.0.0 or higher.

References

high severity

Uncaught Exception

  • Vulnerable module: multer
  • Introduced through: multer@1.4.4

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 multer@1.4.4
    Remediation: Upgrade to multer@2.0.2.

Overview

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

Remediation

Upgrade multer to version 2.0.2 or higher.

References

high severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: next
  • Introduced through: next@12.3.7

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next@12.3.7
    Remediation: Upgrade to next@14.2.32.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) via the resolve-routes. An attacker can access internal resources and potentially exfiltrate sensitive information by crafting requests containing user-controlled headers (e.g., Location) that are forwarded or interpreted without validation.

Note: This is only exploitable if custom middleware logic is implemented in a self-hosted deployment. The project maintainers recommend using the documented NextResponse.next({request}) to explicitly pass the request object.

Remediation

Upgrade next to version 14.2.32, 15.4.2-canary.43, 15.4.7 or higher.

References

high severity

Missing Authorization

  • Vulnerable module: next
  • Introduced through: next@12.3.7

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next@12.3.7
    Remediation: Upgrade to next@13.5.8.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Missing Authorization when using pathname-based checks in middleware for authorization decisions. If i18n configuration is not configured, an attacker can get unintended access to pages one level under the application's root directory.

e.g. https://example.com/foo is accessible. https://example.com/ and https://example.com/foo/bar are not.

Note:

Only self-hosted applications are vulnerable. The vulnerability has been fixed by Vercel on the server side.

Remediation

Upgrade next to version 13.5.8, 14.2.15, 15.0.0-canary.177 or higher.

References

high severity

Uncontrolled Recursion

  • Vulnerable module: next
  • Introduced through: next@12.3.7

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next@12.3.7
    Remediation: Upgrade to next@14.2.7.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Uncontrolled Recursion through the image optimization feature. An attacker can cause excessive CPU consumption by exploiting this vulnerability.

Workaround

Ensure that the next.config.js file has either images.unoptimized, images.loader or images.loaderFile assigned.

Remediation

Upgrade next to version 14.2.7, 15.0.0-canary.109 or higher.

References

high severity

Uncontrolled Recursion

  • Vulnerable module: nodemailer
  • Introduced through: nodemailer@6.10.1

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 nodemailer@6.10.1
    Remediation: Upgrade to nodemailer@7.0.11.

Overview

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

Affected versions of this package are vulnerable to Uncontrolled Recursion in the addressparser function. An attacker can cause the process to terminate immediately by sending an email address header containing deeply nested groups, separated by many :s.

Remediation

Upgrade nodemailer to version 7.0.11 or higher.

References

high severity

Excessive Platform Resource Consumption within a Loop

  • Vulnerable module: braces
  • Introduced through: next-optimized-images@2.6.2

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next-optimized-images@2.6.2 imagemin@6.1.0 globby@8.0.2 fast-glob@2.2.7 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

Denial of Service (DoS)

  • Vulnerable module: dicer
  • Introduced through: multer@1.4.4

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 multer@1.4.4 busboy@0.2.14 dicer@0.2.5

Overview

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

PoC

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

Remediation

There is no fixed version for dicer.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver-regex
  • Introduced through: imagemin-mozjpeg@9.0.0 and imagemin-optipng@8.0.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 bin-version-check@4.0.0 bin-version@3.1.0 find-versions@3.2.0 semver-regex@2.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 bin-version-check@4.0.0 bin-version@3.1.0 find-versions@3.2.0 semver-regex@2.0.0

Overview

semver-regex is a Regular expression for matching semver versions

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

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

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver-regex
  • Introduced through: imagemin-mozjpeg@9.0.0 and imagemin-optipng@8.0.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 bin-version-check@4.0.0 bin-version@3.1.0 find-versions@3.2.0 semver-regex@2.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 bin-version-check@4.0.0 bin-version@3.1.0 find-versions@3.2.0 semver-regex@2.0.0

Overview

semver-regex is a Regular expression for matching semver versions

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

PoC

import semverRegex from 'semver-regex';

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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade semver-regex to version 3.1.3 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: unset-value
  • Introduced through: next-optimized-images@2.6.2

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next-optimized-images@2.6.2 imagemin@6.1.0 globby@8.0.2 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: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next-optimized-images@2.6.2 imagemin@6.1.0 globby@8.0.2 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: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next-optimized-images@2.6.2 imagemin@6.1.0 globby@8.0.2 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: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next-optimized-images@2.6.2 imagemin@6.1.0 globby@8.0.2 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: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next-optimized-images@2.6.2 imagemin@6.1.0 globby@8.0.2 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

Overview

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

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade unset-value to version 2.0.1 or higher.

References

high severity

Cross-site Request Forgery (CSRF)

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

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 axios@0.24.0
    Remediation: Upgrade to axios@0.28.0.

Overview

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

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

Workaround

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

Remediation

Upgrade axios to version 0.28.0, 1.6.0 or higher.

References

medium severity

Allocation of Resources Without Limits or Throttling

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

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 axios@0.24.0
    Remediation: Upgrade to axios@1.12.0.

Overview

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

Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via the data: URL handler. An attacker can trigger a denial of service by crafting a data: URL with an excessive payload, causing allocation of memory for content decoding before verifying content size limits.

Remediation

Upgrade axios to version 1.12.0 or higher.

References

medium severity
new

Directory Traversal

  • Vulnerable module: mjml-core
  • Introduced through: mjml@4.18.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-cli@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-migrate@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-accordion@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-body@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-button@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-carousel@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-column@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-divider@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-group@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-attributes@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-breakpoint@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-font@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-html-attributes@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-preview@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-style@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-title@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-hero@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-image@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-navbar@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-raw@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-section@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-social@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-spacer@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-table@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-text@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-wrapper@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-cli@4.18.0 mjml-migrate@4.18.0 mjml-core@4.18.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-wrapper@4.18.0 mjml-section@4.18.0 mjml-core@4.18.0

Overview

mjml-core is a mjml-core

Affected versions of this package are vulnerable to Directory Traversal via the ignoreIncludes parameter, which still defaults to false. An attacker can access arbitrary files by supplying crafted input that causes traversal outside the intended directory.

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

There is no fixed version for mjml-core.

References

medium severity

Interpretation Conflict

  • Vulnerable module: nodemailer
  • Introduced through: nodemailer@6.10.1

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 nodemailer@6.10.1
    Remediation: Upgrade to nodemailer@7.0.7.

Overview

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

Affected versions of this package are vulnerable to Interpretation Conflict due to improper handling of quoted local-parts containing @. An attacker can cause emails to be sent to unintended external recipients or bypass domain-based access controls by crafting specially formatted email addresses with quoted local-parts containing the @ character.

Remediation

Upgrade nodemailer to version 7.0.7 or higher.

References

medium severity

Remote Code Execution (RCE)

  • Vulnerable module: sharp
  • Introduced through: sharp@0.29.3

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 sharp@0.29.3
    Remediation: Upgrade to sharp@0.30.5.

Overview

sharp is a High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images

Affected versions of this package are vulnerable to Remote Code Execution (RCE). There is a possible vulnerability in logic that is run only at npm install time when installing the package. If an attacker has the ability to set the value of the PKG_CONFIG_PATH environment variable in a build environment then they might be able to use this to inject an arbitrary command at npm install time. This is not part of any runtime code and does not affect Windows users at all.

Remediation

Upgrade sharp to version 0.30.5 or higher.

References

medium severity

Arbitrary File Write via Archive Extraction (Zip Slip)

  • Vulnerable module: decompress-tar
  • Introduced through: imagemin-mozjpeg@9.0.0 and imagemin-optipng@8.0.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-build@3.0.0 decompress@4.2.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-build@3.0.0 decompress@4.2.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-build@3.0.0 decompress@4.2.1 decompress-tarbz2@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-build@3.0.0 decompress@4.2.1 decompress-tarbz2@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-build@3.0.0 decompress@4.2.1 decompress-targz@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-build@3.0.0 decompress@4.2.1 decompress-targz@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-build@3.0.0 download@6.2.5 decompress@4.2.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-build@3.0.0 download@6.2.5 decompress@4.2.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 download@7.1.0 decompress@4.2.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 download@7.1.0 decompress@4.2.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-build@3.0.0 download@6.2.5 decompress@4.2.1 decompress-tarbz2@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-build@3.0.0 download@6.2.5 decompress@4.2.1 decompress-tarbz2@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 download@7.1.0 decompress@4.2.1 decompress-tarbz2@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 download@7.1.0 decompress@4.2.1 decompress-tarbz2@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-build@3.0.0 download@6.2.5 decompress@4.2.1 decompress-targz@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-build@3.0.0 download@6.2.5 decompress@4.2.1 decompress-targz@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 download@7.1.0 decompress@4.2.1 decompress-targz@4.1.1 decompress-tar@4.1.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 download@7.1.0 decompress@4.2.1 decompress-targz@4.1.1 decompress-tar@4.1.1

Overview

decompress-tar is a tar plugin for decompress.

Affected versions of this package are vulnerable to Arbitrary File Write via Archive Extraction (Zip Slip). It is possible to bypass the security measures provided by decompress and conduct ZIP path traversal through symlinks.

PoC

const decompress = require('decompress');

decompress('slip.tar.gz', 'dist').then(files => {
    console.log('done!');
});

Details

It is exploited using a specially crafted zip archive, that holds path traversal filenames. When exploited, a filename in a malicious archive is concatenated to the target extraction directory, which results in the final path ending up outside of the target folder. For instance, a zip may hold a file with a "../../file.exe" location and thus break out 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 malicous 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

There is no fixed version for decompress-tar.

References

medium severity

Race Condition

  • Vulnerable module: next
  • Introduced through: next@12.3.7

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next@12.3.7
    Remediation: Upgrade to next@14.2.24.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Race Condition in the Pages Router. An attacker can cause the server to serve incorrect pageProps data instead of the expected HTML content by exploiting a race condition between two requests, one containing the ?__nextDataRequest=1 query parameter and another with the x-now-route-matches header.

Notes:

  1. This is only exploitable if the CDN provider caches a 200 OK response even in the absence of explicit cache-control headers, enabling a poisoned response to persist and be served to subsequent users;

  2. No backend access or privileged escalation is possible through this vulnerability;

  3. Applications hosted on Vercel's platform are not affected by this issue, as the platform does not cache responses based solely on 200 OK status without explicit cache-control headers.

  4. This is a bypass of the fix for CVE-2024-46982

Workaround

This can be mitigated by stripping the x-now-route-matches header from all incoming requests at your CDN and setting cache-control: no-store for all responses under risk.

Remediation

Upgrade next to version 14.2.24, 15.1.6 or higher.

References

medium severity

Use of Cache Containing Sensitive Information

  • Vulnerable module: next
  • Introduced through: next@12.3.7

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next@12.3.7
    Remediation: Upgrade to next@14.2.31.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Use of Cache Containing Sensitive Information in the image optimization process, when responses from API routes vary based on request headers such as Cookie or Authorization. An attacker can gain unauthorized access to sensitive image data by exploiting cache key confusion, causing responses intended for authenticated users to be served to unauthorized users.

Note: Exploitation requires a prior authorized request to populate the cache.

Remediation

Upgrade next to version 14.2.31, 15.4.2-canary.19, 15.4.5 or higher.

References

medium severity

Server-side Request Forgery (SSRF)

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

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 axios@0.24.0
    Remediation: Upgrade to axios@0.30.0.

Overview

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

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

PoC

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

Remediation

Upgrade axios to version 0.30.0, 1.8.2 or higher.

References

medium severity

Server-side Request Forgery (SSRF)

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

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 axios@0.24.0
    Remediation: Upgrade to axios@0.30.0.

Overview

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

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

Remediation

Upgrade axios to version 0.30.0, 1.8.3 or higher.

References

medium severity

Missing Release of Resource after Effective Lifetime

  • Vulnerable module: inflight
  • Introduced through: eslint-config-next@12.3.7, imagemin-optipng@8.0.0 and others

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 eslint-config-next@12.3.7 @next/eslint-plugin-next@12.3.7 glob@7.1.7 inflight@1.0.6
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 eslint-config-next@12.3.7 eslint-import-resolver-typescript@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 exec-buffer@3.2.0 rimraf@2.7.1 glob@7.2.3 inflight@1.0.6
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next-optimized-images@2.6.2 imagemin@6.1.0 globby@8.0.2 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

Open Redirect

  • Vulnerable module: got
  • Introduced through: imagemin-mozjpeg@9.0.0 and imagemin-optipng@8.0.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-build@3.0.0 download@6.2.5 got@7.1.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-build@3.0.0 download@6.2.5 got@7.1.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 download@7.1.0 got@8.3.2
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 download@7.1.0 got@8.3.2

Overview

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

Remediation

Upgrade got to version 11.8.5, 12.1.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

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

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 axios@0.24.0
    Remediation: Upgrade to axios@0.29.0.

Overview

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

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

PoC

const axios = require('axios');

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

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


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

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade axios to version 0.29.0, 1.6.3 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: glob-parent
  • Introduced through: next-optimized-images@2.6.2

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next-optimized-images@2.6.2 imagemin@6.1.0 globby@8.0.2 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

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: html-minifier
  • Introduced through: mjml@4.18.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-cli@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-cli@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-migrate@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-accordion@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-body@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-button@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-carousel@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-column@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-divider@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-group@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-attributes@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-breakpoint@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-font@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-html-attributes@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-preview@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-style@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-head-title@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-hero@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-image@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-navbar@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-raw@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-section@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-social@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-spacer@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-table@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-text@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-wrapper@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-cli@4.18.0 mjml-migrate@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 mjml@4.18.0 mjml-preset-core@4.18.0 mjml-wrapper@4.18.0 mjml-section@4.18.0 mjml-core@4.18.0 html-minifier@4.0.0

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) through the value parameter of the minify function. This vulnerability derives from the usage of insecure regular expression in reCustomIgnore.

PoC

  const { minify } = require('html-minifier');

const testReDoS = (repeatCount) => {
    const input = '\t'.repeat(repeatCount) + '.\t1x';

    const startTime = performance.now();

    try {
        minify(input);
    } catch (e) {
        console.error('Error during minification:', e);
    }

    const endTime = performance.now();
    console.log(`Input length: ${repeatCount} - Processing time: ${endTime - startTime} ms`);
};


for (let i = 5000; i <= 60000; i += 5000) {
    testReDoS(i);
}

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

There is no fixed version for html-minifier.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: http-cache-semantics
  • Introduced through: imagemin-mozjpeg@9.0.0 and imagemin-optipng@8.0.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 download@7.1.0 got@8.3.2 cacheable-request@2.1.4 http-cache-semantics@3.8.1
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 download@7.1.0 got@8.3.2 cacheable-request@2.1.4 http-cache-semantics@3.8.1

Overview

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). The issue can be exploited via malicious request header values sent to a server, when that server reads the cache policy from the request using this library.

PoC

Run the following script in Node.js after installing the http-cache-semantics NPM package:

const CachePolicy = require("http-cache-semantics");

for (let i = 0; i <= 5; i++) {

const attack = "a" + " ".repeat(i * 7000) +
"z";

const start = performance.now();
new CachePolicy({
headers: {},
}, {
headers: {
"cache-control": attack,
},


});
console.log(`${attack.length}: ${performance.now() - start}ms`);
}

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade http-cache-semantics to version 4.1.1 or higher.

References

medium severity

Inefficient Regular Expression Complexity

  • Vulnerable module: micromatch
  • Introduced through: next-optimized-images@2.6.2

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next-optimized-images@2.6.2 imagemin@6.1.0 globby@8.0.2 fast-glob@2.2.7 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

Resource Exhaustion

  • Vulnerable module: next
  • Introduced through: next@12.3.7

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next@12.3.7
    Remediation: Upgrade to next@13.5.0.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Resource Exhaustion via the cache-control header. An attacker can cause a denial of service to all users requesting the same URL via a CDN by caching empty prefetch responses.

Remediation

Upgrade next to version 13.4.20-canary.13 or higher.

References

medium severity

Improper Input Validation

  • Vulnerable module: postcss
  • Introduced through: next@12.3.7

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next@12.3.7 postcss@8.4.14
    Remediation: Upgrade to next@13.5.4.

Overview

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

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

Remediation

Upgrade postcss to version 8.4.31 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver-regex
  • Introduced through: imagemin-mozjpeg@9.0.0 and imagemin-optipng@8.0.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 bin-version-check@4.0.0 bin-version@3.1.0 find-versions@3.2.0 semver-regex@2.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 bin-version-check@4.0.0 bin-version@3.1.0 find-versions@3.2.0 semver-regex@2.0.0

Overview

semver-regex is a Regular expression for matching semver versions

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper usage of regex in the semverRegex() function.

PoC

'0.0.1-' + '-.--'.repeat(i) + ' '

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade semver-regex to version 3.1.4, 4.0.3 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: semver-regex
  • Introduced through: imagemin-mozjpeg@9.0.0 and imagemin-optipng@8.0.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-mozjpeg@9.0.0 mozjpeg@7.1.1 bin-wrapper@4.1.0 bin-version-check@4.0.0 bin-version@3.1.0 find-versions@3.2.0 semver-regex@2.0.0
  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 imagemin-optipng@8.0.0 optipng-bin@7.0.1 bin-wrapper@4.1.0 bin-version-check@4.0.0 bin-version@3.1.0 find-versions@3.2.0 semver-regex@2.0.0

Overview

semver-regex is a Regular expression for matching semver versions

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

PoC


// import of the vulnerable library
const semverRegex = require('semver-regex');
// import of measurement tools
const { PerformanceObserver, performance } = require('perf_hooks');

// config of measurements tools
const obs = new PerformanceObserver((items) => {
 console.log(items.getEntries()[0].duration);
 performance.clearMarks();
});
obs.observe({ entryTypes: ['measure'] });

// base version string
let version = "v1.1.3-0a"

// Adding the evil code, resulting in string
// v1.1.3-0aa.aa.aa.aa.aa.aa.a…a.a"
for(let i=0; i < 20; i++) {
   version += "a.a"
}

// produce a good version
// Parses well for the regex in milliseconds
let goodVersion = version + "2"

// good version proof
performance.mark("good before")
const goodresult = semverRegex().test(goodVersion);
performance.mark("good after")


console.log(`Good result: ${goodresult}`)
performance.measure('Good', 'good before', 'good after');

// create a bad/exploit version that is invalid due to the last $ sign
// will cause the nodejs engine to hang, if not, increase the a.a
// additions above a bit.
badVersion = version + "aaaaaaa$"

// exploit proof
performance.mark("bad before")
const badresult = semverRegex().test(badVersion);
performance.mark("bad after")

console.log(`Bad result: ${badresult}`)
performance.measure('Bad', 'bad before', 'bad after');

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade semver-regex to version 3.1.2 or higher.

References

medium severity

MPL-2.0 license

  • Module: axe-core
  • Introduced through: eslint-config-next@12.3.7

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 eslint-config-next@12.3.7 eslint-plugin-jsx-a11y@6.10.2 axe-core@4.11.1

MPL-2.0 license

low severity
new

Improper Validation of Syntactic Correctness of Input

  • Vulnerable module: aws-sdk
  • Introduced through: aws-sdk@2.1693.0

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 aws-sdk@2.1693.0

Overview

Affected versions of this package are vulnerable to Improper Validation of Syntactic Correctness of Input in the region input field. An attacker can cause AWS API calls to be routed to unintended or non-existent hosts by supplying an invalid value to this parameter.

##Workaround

This vulnerability can be mitigated by implementing proper input sanitization in application code or migrating to AWS SDK for JavaScript v3.

Remediation

There is no fixed version for aws-sdk.

low severity

Missing Source Correlation of Multiple Independent Data

  • Vulnerable module: next
  • Introduced through: next@12.3.7

Detailed paths

  • Introduced through: do-next@g1st/do-next#d42e133b68f14aa16b8a9e490826cfbbeb7b7d37 next@12.3.7
    Remediation: Upgrade to next@14.2.31.

Overview

next is a react framework.

Affected versions of this package are vulnerable to Missing Source Correlation of Multiple Independent Data in image-optimizer. An attacker can cause arbitrary files to be downloaded with attacker-controlled content and filenames by supplying malicious external image sources.

Note: This is only exploitable if the application is configured to allow external image sources via the images.domains or images.remotePatterns configuration.

Remediation

Upgrade next to version 14.2.31, 15.4.2-canary.19, 15.4.5 or higher.

References