Vulnerabilities

4 via 13 paths

Dependencies

492

Source

GitHub

Commit

5ab6acd6

Find, fix and prevent vulnerabilities in your code.

Severity
  • 1
  • 2
  • 1
Status
  • 4
  • 0
  • 0

high severity
new

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: ajv
  • Introduced through: file-loader@6.2.0 and url-loader@4.1.1

Detailed paths

  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 file-loader@6.2.0 schema-utils@3.3.0 ajv@6.12.6
  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 url-loader@4.1.1 schema-utils@3.3.0 ajv@6.12.6

Overview

ajv is an Another JSON Schema Validator

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to improper validation of the pattern keyword when combined with $data references. An attacker can cause the application to become unresponsive and exhaust CPU resources by submitting a specially crafted regular expression payload.

Note:

This is only exploitable if the $data option is enabled.

PoC

const Ajv = require('ajv');

// Vulnerable configuration — $data enables runtime pattern injection
const ajv = new Ajv({ $data: true });

const schema = {
  type: 'object',
  properties: {
    pattern: { type: 'string' },
    value: {
      type: 'string',
      pattern: { $data: '1/pattern' }  // Pattern comes from the data itself
    }
  }
};

const validate = ajv.compile(schema);

// Malicious payload — both the pattern and the triggering input
const maliciousPayload = {
  pattern: '^(a|a)*$',           // Catastrophic backtracking pattern
  value: 'a'.repeat(30) + 'X'    // 30 'a's followed by 'X' to force full backtracking
};

console.time('attack');
validate(maliciousPayload);       // Blocks the entire Node.js process for ~44 seconds
console.timeEnd('attack');

Details

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

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

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

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

This regular expression accomplishes the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

Remediation

Upgrade ajv to version 8.18.0 or higher.

References

medium severity
new

Infinite loop

  • Vulnerable module: bn.js
  • Introduced through: crypto-browserify@3.12.1

Detailed paths

  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 create-ecdh@4.0.4 bn.js@4.12.3
  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 diffie-hellman@5.0.3 bn.js@4.12.3
  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 public-encrypt@4.0.3 bn.js@4.12.3
  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 browserify-sign@4.2.5 elliptic@6.6.1 bn.js@4.12.3
  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 create-ecdh@4.0.4 elliptic@6.6.1 bn.js@4.12.3
  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 diffie-hellman@5.0.3 miller-rabin@4.0.1 bn.js@4.12.3
  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 browserify-sign@4.2.5 parse-asn1@5.1.9 asn1.js@4.10.1 bn.js@4.12.3
  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 public-encrypt@4.0.3 parse-asn1@5.1.9 asn1.js@4.10.1 bn.js@4.12.3

Overview

Affected versions of this package are vulnerable to Infinite loop. Calling maskn(0) on any BN instance corrupts the internal state, causing toString(), divmod(), and other methods to enter an infinite loop, hanging the process indefinitely.

PoC

const BN = require('bn.js'); // any version up to 5.2.2

const x = new BN('1', 10).maskn(0);

// Internal state is now corrupted:
console.log('x.words.length =', x.words.length); // 1
console.log('x.length       =', x.length);        // 0 (INVALID - should be >= 1)
console.log('x.isZero()     =', x.isZero());      // false (WRONG - should be true)

// This will hang forever:
// console.log(x.toString());

Remediation

Upgrade bn.js to version 5.2.3 or higher.

References

medium severity

Use of a Cryptographic Primitive with a Risky Implementation

  • Vulnerable module: elliptic
  • Introduced through: crypto-browserify@3.12.1

Detailed paths

  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 browserify-sign@4.2.5 elliptic@6.6.1
  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 crypto-browserify@3.12.1 create-ecdh@4.0.4 elliptic@6.6.1

Overview

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

Affected versions of this package are vulnerable to Use of a Cryptographic Primitive with a Risky Implementation due to the incorrect computation of the byte-length of k value with leading zeros resulting in its truncation. An attacker can obtain the secret key by analyzing both a faulty signature generated by a vulnerable implementation and a correct signature for the same inputs.

Note:

There is a distinct but related issue CVE-2024-48948.

Remediation

There is no fixed version for elliptic.

References

low severity

Directory Traversal

  • Vulnerable module: sirv
  • Introduced through: webpack-bundle-analyzer@4.10.2

Detailed paths

  • Introduced through: appersonautomotive.com@webjamapps/AppersonAuto#5ab6acd6fd87d453c0c2cfa6f6e2166d2ef69cb0 webpack-bundle-analyzer@4.10.2 sirv@2.0.4
    Remediation: Upgrade to webpack-bundle-analyzer@5.2.0.

Overview

sirv is a The optimized & lightweight middleware for serving requests to static assets

Affected versions of this package are vulnerable to Directory Traversal via the viaLocal function, which uses a dirname prefix. An attacker can access files outside the intended public directory by sending crafted requests that exploit symlinks and naming similarities, bypassing access restrictions.

Note: This is only exploitable if the server is explicitly exposed to the network using the --host flag or the server.host configuration option, the public directory feature is enabled, and there are symlinks in a public 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

Upgrade sirv to version 3.0.2 or higher.

References