Vulnerabilities

7 via 7 paths

Dependencies

99

Source

GitHub

Find, fix and prevent vulnerabilities in your code.

Severity
  • 1
  • 5
  • 1
Status
  • 7
  • 0
  • 0

critical severity
new

Origin Validation Error

  • Vulnerable module: undici
  • Introduced through: nx@24.1.1

Detailed paths

  • Introduced through: contract-case@case-contract-testing/contract-case › nx@24.1.1 › undici@7.30.1

Overview

undici is an An HTTP/1.1 client, written from scratch for Node.js

Affected versions of this package are vulnerable to Origin Validation Error via the cache-handler.js redirect-hop inspection logic when an originless Agent composes the redirect and shared cache interceptors as compose(redirect(), cache()). Undici decides whether to store the final response under the original request key by inspecting only the final redirect hop, bypassing the earlier fix for CVE-2026-109829 that compared only the initial and final origins. A redirect that bounces through an untrusted intermediate origin and returns to the trusted origin is still cached under the trusted key, an intermediate hop's Vary header is dropped so a response that varies on Authorization or Cookie can be served to a different user, and an intermediate hop's no-cache or default-uncacheable status is ignored so a non-storable redirect is laundered into a cacheable entry. An attacker who controls the target of a redirect from a trusted URL can poison the cached entry for that URL or have a private, per-user response served to a later caller.

Note: This is only exploitable when an originless Agent, a shared cache store, and compose(redirect(), cache()) are all used together.

Workaround

Compose the interceptors as compose(cache(), redirect()), use per-origin dispatchers and cache stores, or disable shared caching on redirect-capable requests.

Remediation

Upgrade undici to version 7.30.2, 8.12.4 or higher.

References

high severity
new

Authorization Bypass Through User-Controlled Key

  • Vulnerable module: undici
  • Introduced through: nx@24.1.1

Detailed paths

  • Introduced through: contract-case@case-contract-testing/contract-case › nx@24.1.1 › undici@7.30.1

Overview

undici is an An HTTP/1.1 client, written from scratch for Node.js

Affected versions of this package are vulnerable to Authorization Bypass Through User-Controlled Key via the CacheHandler.onResponseStart function in the cache handler. With an originless Agent using a shared cache and compose(redirect(), cache()), when a credential-bearing request to a user-specific URL receives a same-origin redirect to a cacheable per-user resource, the response is stored under the original URL without varying on credentials. A later authenticated or unauthenticated caller requesting that URL receives the first user’s private response from the cache.

Notes

  • The shared cache must be a MemoryCacheStore or SqliteCacheStore; the advisory identifies these stores as the affected cache implementations.

Workarounds

  • Compose the interceptors as compose(cache(), redirect()) to prevent redirected per-user responses from being cached under the original request URL.
  • Use per-origin dispatchers and cache stores to prevent a shared cache from serving one origin’s user-specific response to callers of another.
  • Disable shared caching for credential-bearing requests that can follow redirects to prevent private responses from being reused for other callers.
  • Set appropriate Vary headers on per-user responses, or mark them private or no-store, to prevent shared-cache reuse across users.

Remediation

Upgrade undici to version 7.30.2, 8.12.4 or higher.

References

high severity
new

Improper Validation of Integrity Check Value

  • Vulnerable module: undici
  • Introduced through: nx@24.1.1

Detailed paths

  • Introduced through: contract-case@case-contract-testing/contract-case › nx@24.1.1 › undici@7.30.1

Overview

undici is an An HTTP/1.1 client, written from scratch for Node.js

Affected versions of this package are vulnerable to Improper Validation of Integrity Check Value via the fetch() function's Subresource Integrity verification logic, which splits the integrity string on a single space rather than on all ASCII whitespace characters. An integrity value whose digest is preceded by a horizontal tab or other non-space ASCII whitespace (e.g. \tsha256-...) is parsed as a single unrecognized token and skipped. When no recognized algorithm remains, the integrity list is treated as empty and the response is accepted unconditionally, allowing a server that returns a body different from the pinned digest to pass the check. An attacker who controls the response body can deliver arbitrary bytes to an application that uses whitespace-surrounded SRI metadata, with no integrity error raised.

Workaround

Supply SRI integrity metadata without surrounding whitespace, using a single space to separate multiple digests.

Remediation

Upgrade undici to version 7.30.2, 8.12.4 or higher.

References

high severity
new

Insertion of Sensitive Information into Log File

  • Vulnerable module: undici
  • Introduced through: nx@24.1.1

Detailed paths

  • Introduced through: contract-case@case-contract-testing/contract-case › nx@24.1.1 › undici@7.30.1

Overview

undici is an An HTTP/1.1 client, written from scratch for Node.js

Affected versions of this package are vulnerable to Insertion of Sensitive Information into Log File via the cleanRequestHeaders function in lib/handler/redirect-handler.js, when request headers are supplied as an array of [name, value] tuples (e.g. via Object.entries(headers)). The redirect interceptor is responsible for stripping sensitive headers such as Authorization, Cookie, Proxy-Authorization, and Host on cross-origin redirects, but it misreads tuple-format headers as a flat alternating [name, value, name, value, ...] list, causing header names to never match the strip list and leaving sensitive headers intact. When a header-normalizing interceptor such as cache() or deduplicate() is composed outside redirect(), it serializes the retained headers onto the cross-origin request, disclosing origin-bound credentials to the redirect destination. This is a representation-dependent bypass of the cross-origin header stripping introduced to address CVE-2024-30260.

Note: This is only exploitable when headers are supplied as an array of [name, value] tuples and a header-normalizing interceptor (cache() or deduplicate()) is composed outside the redirect() interceptor.

Workaround

Supply request headers as a plain object or a flat [name, value, name, value, ...] array rather than an array of [name, value] tuples, or compose the redirect() interceptor outside the normalizing interceptor (cache() or deduplicate()).

Remediation

Upgrade undici to version 7.30.2, 8.12.4 or higher.

References

high severity
new

Origin Validation Error

  • Vulnerable module: undici
  • Introduced through: nx@24.1.1

Detailed paths

  • Introduced through: contract-case@case-contract-testing/contract-case › nx@24.1.1 › undici@7.30.1

Overview

undici is an An HTTP/1.1 client, written from scratch for Node.js

Affected versions of this package are vulnerable to Origin Validation Error via the cache interceptor in lib/interceptor/cache.js when an Agent composes the redirect and shared cache interceptors as compose(redirect(), cache()). The redirect handler strips origin-bound credential headers from a conditional revalidation request but does not strip the cache-generated If-None-Match or If-Modified-Since validators, so when the original origin redirects the revalidation request to a different origin, the redirect destination receives the original origin's validators. undici then treats a 304 Not Modified response from that different origin as successful revalidation of the stored representation, allowing a shared cache to serve the original origin's authenticated response - including one gated by Authorization - to a subsequent unauthenticated caller.

Note: This is only exploitable when a shared MemoryCacheStore or SqliteCacheStore and the composition compose(redirect(), cache()) are used, and an attacker can influence a cross-origin redirect on the revalidated request.

Workaround

Compose the interceptors as compose(cache(), redirect()), use per-origin dispatchers and cache stores, or disable shared caching on redirect-capable requests.

Remediation

Upgrade undici to version 7.30.2, 8.12.4 or higher.

References

high severity
new

Uncaught Exception

  • Vulnerable module: undici
  • Introduced through: nx@24.1.1

Detailed paths

  • Introduced through: contract-case@case-contract-testing/contract-case › nx@24.1.1 › undici@7.30.1

Overview

undici is an An HTTP/1.1 client, written from scratch for Node.js

Affected versions of this package are vulnerable to Uncaught Exception via the cache interceptor in lib/interceptor/cache.js when it is composed with a downstream handler that throws during response processing. When a cached response is replayed through the cache interceptor's async store path, a throw raised asynchronously - for example from the built-in dump interceptor exceeding its maxSize, or the decompress interceptor rejecting more than five Content-Encoding values - escapes as an uncaught exception or unhandled promise rejection and terminates the Node.js process. A malicious or compromised HTTP server can trigger this crash by serving a cacheable response whose replayed body or headers cause the downstream handler to throw, including on a 304 revalidation of a stale cache entry.

Note: This is only exploitable when the cache interceptor is composed with a downstream response handler that throws during response processing (such as dump with a maxSize limit, or decompress with more than five Content-Encoding values).

Workaround

Avoid composing the cache interceptor with a response handler that throws during response processing (such as dump with a maxSize) until upgrading.

Remediation

Upgrade undici to version 7.30.2, 8.12.4 or higher.

References

medium severity
new

Prototype Pollution

  • Vulnerable module: minimatch
  • Introduced through: nx@24.1.1

Detailed paths

  • Introduced through: contract-case@case-contract-testing/contract-case › nx@24.1.1 › minimatch@11.0.8

Overview

minimatch is a minimal matching utility.

Affected versions of this package are vulnerable to Prototype Pollution in the optionsKey and copyOptions functions in src/index.ts. An attacker who controls the options object passed to minimatch() can poison the module-global matcher cache by supplying a __proto__ key (for example via JSON.parse), since optionsKey() assigns it no weight while copyOptions()'s for...in loop copies it as an inherited property onto the cached Minimatch instance, causing later, independent callers matching the same pattern string with no options to receive the attacker's cached behavior (such as case-insensitive matching) instead of the default. This requires an attacker-influenced options object and a pattern string also reused by another caller in the same process.

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 minimatch to version 11.0.10 or higher.

References