Vulnerabilities

22 via 22 paths

Dependencies

128

Source

GitHub

Find, fix and prevent vulnerabilities in your code.

Severity
  • 14
  • 8
Status
  • 22
  • 0
  • 0

high severity

Allocation of Resources Without Limits or Throttling

  • Vulnerable module: brace-expansion
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › brace-expansion@5.0.8
    Remediation: Upgrade to nx@23.1.2.

Overview

brace-expansion is a Brace expansion as known from sh/bash

Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling in the expand(), expand_(), combine(), and expandSequence() functions, which bound the accumulator where results are combined but not the intermediate arrays that feed it. An attacker can crash the process with an uncatchable out-of-memory error, or stall the event loop for minutes, by supplying a pattern with many comma-separated alternatives that each receive an independent maxLength allowance and accumulate without a cumulative limit, or a padded sequence whose generation ignores maxLength and does work proportional to max * width. Exploitation requires the application to pass untrusted input to expand(), directly or transitively through a glob or pattern-matching library.

Workaround

This vulnerability can be avoided by passing an explicitly small max together with a small maxLength to expand(), bounding both the result count and length, since a small maxLength alone is insufficient on affected versions where it is applied per alternative rather than cumulatively.

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

Remediation

Upgrade brace-expansion to version 1.1.18, 2.1.4, 3.0.6, 5.0.9 or higher.

References

high severity

Uncontrolled Recursion

  • Vulnerable module: brace-expansion
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › brace-expansion@5.0.8
    Remediation: Upgrade to nx@23.3.0.

Overview

brace-expansion is a Brace expansion as known from sh/bash

Affected versions of this package are vulnerable to Uncontrolled Recursion via uncontrolled recursion in expand_ when processing deeply nested brace patterns. An attacker can supply approximately 6 KB of deeply nested braces (e.g., { repeated ~3,200 times followed by a,b and the matching } characters) to exhaust the native call stack and crash the process with a RangeError: Maximum call stack size exceeded. The max and maxLength bounds do not prevent this because the stack is exhausted during recursive descent into sub-expansions, before the result set grows.

Remediation

Upgrade brace-expansion to version 1.1.20, 2.1.6, 3.0.8, 5.0.11 or higher.

References

high severity

Uncontrolled Recursion

  • Vulnerable module: brace-expansion
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › brace-expansion@5.0.8
    Remediation: Upgrade to nx@23.3.0.

Overview

brace-expansion is a Brace expansion as known from sh/bash

Affected versions of this package are vulnerable to Uncontrolled Recursion via two distinct stack-exhaustion paths in parseCommaParts. In the first, the function recurses on the remainder of the string once per brace group, so a chain of approximately 7,000 groups (~29 KB of input) exhausts the native call stack and throws a RangeError. In the second, push.apply passes one argument per element, meaning a single large comma-separated array inside a brace group overflows the stack at a recursion depth of exactly one, requiring roughly 125,000 comma-separated elements. Neither the max nor maxLength options can bound either path because the crash occurs during parsing, before any expansion takes place.

Remediation

Upgrade brace-expansion to version 1.1.19, 2.1.5, 3.0.7, 5.0.10 or higher.

References

high severity

Prototype Pollution

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution via insufficient hardening of runtime option handling across multiple request-processing helpers (lib/helpers/resolveConfig.js, lib/helpers/toFormData.js, lib/adapters/fetch.js, and related files). An attacker can supply a manipulated configuration object that overrides internally owned fetch options (such as body, headers, method, signal) or bypasses the default formSerializer.maxDepth limit, leading to integrity violations in outgoing requests or a crash causing denial of service.

Note: This is only exploitable when the caller does not explicitly set formSerializer.maxDepth, allowing a prototype-level or caller-supplied value to override the expected default.

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade axios to version 0.34.0, 1.20.0 or higher.

References

high severity

Allocation of Resources Without Limits or Throttling

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.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 unsafe runtime option handling in the fetch and HTTP adapters, where user-supplied fetchOptions are merged into the resolved request options without sanitization. An attacker who can influence request configuration can trigger uncontrolled resource consumption, crashing the process.

Note: This is only exploitable when requests follow redirects (i.e., maxRedirects is not set to 0), unless application code manually follows the malicious redirect and re-enters axios.

Remediation

Upgrade axios to version 1.20.0 or higher.

References

high severity

Improper Validation of Specified Quantity in Input

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Improper Validation of Specified Quantity in Input via unsafe runtime option handling in the fetch and HTTP adapters, where user-supplied fetchOptions are merged into the resolved request options without sanitization or allowlist enforcement. An attacker who can influence request configuration can supply option values that override Axios-owned fields (such as signal, method, headers, or body) or inject unexpected fetch option keys, causing the request pipeline to crash and producing a denial of service.

Remediation

Upgrade axios to version 1.20.0 or higher.

References

high severity

Improper Validation of Specified Quantity in Input

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Improper Validation of Specified Quantity in Input via unsafe runtime option handling in the fetch and HTTP adapters, where user-supplied fetchOptions are merged into the resolved request options without sanitization or allowlist enforcement. An attacker who can influence request configuration can supply option values that override Axios-owned fields (such as signal, method, headers, or body) or inject unexpected fetch option keys, causing the request pipeline to crash and producing a denial of service.

Remediation

Upgrade axios to version 1.20.0 or higher.

References

high severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.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) via improper validation of runtime options in resolveConfig and related helpers, where an attacker-controlled or malformed configuration value can trigger a crash in the request processing pipeline. The hardening of option handling across fetch.js, http.js, dispatchRequest.js, and supporting helpers indicates that unsanitized option objects could be passed through to the underlying fetch or HTTP adapter in a way that causes an unhandled runtime error, crashing the process and denying service to other users.

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 1.20.0 or higher.

References

high severity
new

Improper Removal of Sensitive Information Before Storage or Transfer

  • Vulnerable module: follow-redirects
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › follow-redirects@1.16.0
    Remediation: Upgrade to nx@23.3.0.

Overview

Affected versions of this package are vulnerable to Improper Removal of Sensitive Information Before Storage or Transfer via the _sanitizeOptions function in index.js when HTTP headers are supplied as a flat key/value array rather than an object. Because the array form is not converted before sensitive-header filtering is applied, headers designated as sensitive are not recognized and are not stripped on redirect, allowing an attacker in a position to observe outbound requests to capture those header values.

Remediation

Upgrade follow-redirects to version 1.16.1 or higher.

References

high severity
new

Insertion of Sensitive Information Into Sent Data

  • Vulnerable module: follow-redirects
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › follow-redirects@1.16.0
    Remediation: Upgrade to nx@23.3.0.

Overview

Affected versions of this package are vulnerable to Insertion of Sensitive Information Into Sent Data via the _sanitizeOptions function in index.js, which uses instanceof Array to validate the sensitiveHeaders option. An attacker who controls the sensitiveHeaders value can supply a cross-realm array (created in a separate VM context) that passes Array.isArray but fails the instanceof Array check, causing the guard to reset sensitiveHeaders to an empty array and allowing sensitive headers to be forwarded to a redirect target that should not receive them.

PoC

Start two loopback HTTP servers. The first returns a 302 redirect to the second. Send X-API-Key and list that name in sensitiveHeaders, then compare a normal array with a genuine cross-realm array created by:

const vm = require('node:vm');
const sensitiveHeaders = vm.runInNewContext(`['X-API-Key']`);

Observed against both source and the exact npm 1.16.1 package:

  • Same-realm ['X-API-Key']: the redirect target did not receive the key.
  • Cross-realm ['X-API-Key']: Array.isArray(value) was true, value instanceof Array was false, and the redirect target received X-API-Key.
  • An unrelated X-Harmless header remained present in both cases.

The complete 3.5 KB loopback-only harness and raw JSON output are available privately.

Note: The PoC uses two loopback HTTP servers and a cross-realm array created via Node.js node:vm, tested against npm package version 1.16.1.

Remediation

Upgrade follow-redirects to version 1.16.2 or higher.

References

high severity

Unchecked Input for Loop Condition

  • Vulnerable module: smol-toml
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › smol-toml@1.6.1
    Remediation: Upgrade to nx@23.3.0.

Overview

smol-toml is an A small, fast, and correct TOML parser/serializer

Affected versions of this package are vulnerable to Unchecked Input for Loop Condition due to the skipUntil comment-skipping logic in src/util.ts. An attacker can hang parse() by supplying a TOML document with a value in an array or inline table followed by a # comment that runs to end of input without a trailing newline. The parser gets stuck in an internal loop while searching for the end of the structure, pinning CPU and preventing the application from completing TOML parsing.

Remediation

Upgrade smol-toml to version 1.7.1 or higher.

References

high severity

Unintended Proxy or Intermediary ('Confused Deputy')

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Unintended Proxy or Intermediary ('Confused Deputy') via insufficient hardening of runtime option handling in the fetch and HTTP adapters (lib/adapters/fetch.js, lib/adapters/http.js, and related helpers). An authenticated attacker can supply malicious request options that are passed through without sanitization, allowing them to override Axios-controlled fetch properties such as body, headers, method, signal, duplex, and credentials, leading to a full compromise of request confidentiality and integrity.

Remediation

Upgrade axios to version 1.20.0 or higher.

References

high severity

Server-side Request Forgery (SSRF)

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.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) via unsafe merging of user-supplied fetchOptions into the resolved request options object in lib/adapters/fetch.js. An attacker who controls request configuration can supply a fetchOptions object with prototype-polluting keys (e.g. __proto__ or constructor), which are spread directly into the options passed to the Fetch API without sanitization, allowing pollution of Object.prototype and affecting downstream system-level behaviour. The fix replaces the spread with Object.assign(Object.create(null), fetchOptions) to strip inherited properties and enforces an allowlist of safe Fetch API keys.

Note: This is only exploitable when the attacker can influence the fetchOptions configuration passed to axios requests.

Remediation

Upgrade axios to version 1.20.0 or higher.

References

high severity

Unintended Proxy or Intermediary ('Confused Deputy')

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Unintended Proxy or Intermediary ('Confused Deputy') via improper enforcement of maxRedirects: 0 in the fetch adapter, where user-supplied fetchOptions are merged into the resolved request options without defaulting the redirect field. When a caller sets maxRedirects: 0 to prevent redirects, the fetch adapter does not apply redirect: 'manual' unless the caller also explicitly sets fetchOptions.redirect, causing the underlying fetch runtime to silently follow a 302 redirect from the initial target and forward the request - including any credentials or sensitive headers - to the redirect destination, which may be attacker-controlled.

Note: This is only exploitable when requests are configured with maxRedirects: 0 but without fetchOptions.redirect: 'manual' or an equivalent runtime-specific redirect control.

Remediation

Upgrade axios to version 1.20.0 or higher.

References

medium severity

Improper Input Validation

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Improper Input Validation via insufficient hardening of runtime option handling in the fetch and HTTP adapters, where user-supplied fetchOptions are merged into the resolved request options without sanitization. An attacker who can influence request configuration can inject or override internal Axios-owned options (such as body, headers, method, signal, credentials), leading to integrity impact on the downstream system receiving the request.

Remediation

Upgrade axios to version 1.20.0 or higher.

References

medium severity
new

Improper Isolation or Compartmentalization

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Improper Isolation or Compartmentalization in lib/helpers/shouldBypassProxy.js, which matches NO_PROXY entries by exact host or IP and has no parsing for CIDR notation, so an entry such as 127.0.0.0/8 or 10.0.0.0/8 never matches and the request is routed through the configured proxy. An attacker able to observe or operate that proxy can read internal hostnames, request URLs, headers, and any credentials those requests carry, by receiving traffic the deployment intended to keep direct. This requires a Node.js deployment with HTTP_PROXY or HTTPS_PROXY set, at least one NO_PROXY entry written in CIDR form, and a proxy sitting outside the intended trust boundary, and exact host or IP entries in NO_PROXY are matched correctly.

Note: This is only exploitable when requests are configured with proxy: false.

Workaround

This vulnerability can be avoided by writing NO_PROXY entries for sensitive destinations as exact hosts or IP addresses rather than CIDR ranges.

Remediation

Upgrade axios to version 1.20.0 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution via unsafe merging of user-supplied fetchOptions in lib/adapters/fetch.js. When a caller passes a fetchOptions object, axios spreads it directly into the resolved request options without sanitizing prototype-inherited properties, allowing an attacker who controls request configuration to pollute Object.prototype and influence downstream system behavior such as request routing or security-sensitive option values.

Note: This is only exploitable when the attacker can influence the fetchOptions configuration object passed to axios requests.

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade axios to version 1.20.0 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution via insufficiently hardened runtime option handling in the fetch and HTTP adapters (lib/adapters/fetch.js, lib/adapters/http.js, and related helpers), where user-controlled or prototype-polluted properties on request configuration objects are merged into fetch/request options without sanitization. An attacker who can introduce a prototype-pollution gadget elsewhere in the application can inject arbitrary properties into the resolved fetch options, leading to integrity violations on outbound requests.

Note: This is only exploitable if an existing prototype-pollution path is present in the application.

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade axios to version 0.34.0, 1.20.0 or higher.

References

medium severity

Prototype Pollution

  • Vulnerable module: axios
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › axios@1.18.1
    Remediation: Upgrade to nx@23.3.0.

Overview

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

Affected versions of this package are vulnerable to Prototype Pollution via insufficient hardening of runtime option handling in the fetch and HTTP adapters (lib/adapters/fetch.js, lib/adapters/http.js, and related helpers). An attacker who can influence request configuration options passed to axios can supply unsanitized values that bypass expected constraints, resulting in unintended modification of downstream system behavior (SI:H) such as request routing or proxy bypass, while leaving the client-side response unaffected (VC:N, VI:N, VA:N).

Details

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

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

  • Unsafe Object recursive merge

  • Property definition by path

Unsafe Object recursive merge

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

merge (target, source)

  foreach property of source

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

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

    else

      target[property] = source[property]

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

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

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

Property definition by path

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

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

Types of attacks

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

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

Affected environments

The following environments are susceptible to a Prototype Pollution attack:

  • Application server

  • Web server

  • Web browser

How to prevent

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

  2. Require schema validation of JSON input.

  3. Avoid using unsafe recursive merge functions.

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

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

For more information on this vulnerability type:

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

Remediation

Upgrade axios to version 1.20.0 or higher.

References

medium severity

Regular Expression Denial of Service (ReDoS)

  • Vulnerable module: brace-expansion
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › brace-expansion@5.0.8
    Remediation: Upgrade to nx@23.3.0.

Overview

brace-expansion is a Brace expansion as known from sh/bash

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the expand_ function, which implements a Bash quirk where a brace group followed by a comma set (e.g. {a},b}) causes the parser to rewrite the input string and restart the scan, absorbing one closing brace per pass. Because each pass re-reads the entire string and the string itself grows by approximately 25 characters per rewrite (due to the escClose sentinel), the work is quadratic in the number of trailing braces, allowing an attacker to block the event loop with a small input. An input of the form '{a}' + '}'.repeat(128000) + ',z}' takes approximately 27 seconds to process while producing only two results, and neither the existing max nor maxLength guards can prevent this because the cost is incurred during parsing before any result set is produced.

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 brace-expansion to version 1.1.21, 2.1.7, 3.0.9, 5.0.12 or higher.

References

medium severity
new

Incorrect Regular Expression

  • Vulnerable module: follow-redirects
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › follow-redirects@1.16.0
    Remediation: Upgrade to nx@23.3.0.

Overview

Affected versions of this package are vulnerable to Incorrect Regular Expression in the escapeRegex function in index.js, which escapes ], \, /, (, ), *, +, ?, ., and $ but leaves ^, |, [, {, and } intact, and whose output is joined into the alternation that the RedirectableRequest constructor compiles into this._headerFilter. An attacker can receive a custom credential header that the application declared through sensitiveHeaders by drawing the request into a cross-origin redirect to a host they control, because a declared name holding ^, such as X-Api^Key, gains a mid-pattern start-of-string anchor and can never match, while one holding |, such as X-Token|Secret, splits into the separate alternatives X-Token and Secret, so the real header is forwarded and unrelated headers by those names are stripped instead. Only ^ and | are reachable in practice, since Node rejects [, {, and } in header names with ERR_INVALID_HTTP_TOKEN and declaring one of them instead throws a SyntaxError from the constructor, and the built-in Authorization, Proxy-Authorization, and Cookie entries contain no metacharacters, so the failure is confined to applications that declare their own names and silently lose the protection they configured.

Remediation

Upgrade follow-redirects to version 1.16.1 or higher.

References

medium severity
new

Inefficient Algorithmic Complexity

  • Vulnerable module: smol-toml
  • Introduced through: nx@22.7.12

Detailed paths

  • Introduced through: contract-case@case-contract-testing/case › nx@22.7.12 › smol-toml@1.6.1
    Remediation: Upgrade to nx@23.3.0.

Overview

smol-toml is an A small, fast, and correct TOML parser/serializer

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via the parseKey function in src/struct.ts, which used the regular expression KEY_PART_RE (/^[a-zA-Z0-9-_]+[ \t]*$/) to validate bare key components. An attacker can supply a TOML document containing a long bare key with trailing characters that cause catastrophic backtracking in the regex engine, blocking the event loop and crashing the process.

Remediation

Upgrade smol-toml to version 1.9.0 or higher.

References