Vulnerabilities |
10 via 11 paths |
|---|---|
Dependencies |
219 |
Source |
GitHub |
Find, fix and prevent vulnerabilities in your code.
high severity
new
- Vulnerable module: ws
- Introduced through: @nestjs/graphql@13.4.5
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › @nestjs/graphql@13.4.5 › ws@8.21.3Remediation: Upgrade to @nestjs/graphql@14.2.2.
Overview
ws is a simple to use websocket client, server and console for node.js.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via the receiverOnPing handler, which generates and buffers automatic Pong responses without any bound on the number of pending responses. A malicious peer can continuously send Ping frames while pausing reads, causing the victim process to queue unbounded Pong frames until memory is exhausted and the process terminates due to an out-of-memory condition.
Workaround
In vulnerable versions, set the autoPong option to false where available, or enforce rate-limiting combined with heartbeats.
Remediation
Upgrade ws to version 5.2.8, 6.2.7, 7.5.14, 8.23.0 or higher.
References
high severity
- Vulnerable module: @graphql-tools/utils
- Introduced through: @nestjs/graphql@13.4.5
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › @nestjs/graphql@13.4.5 › @graphql-tools/utils@12.0.0Remediation: Upgrade to @nestjs/graphql@14.1.0.
Overview
@graphql-tools/utils is a Common package containing utils and types for GraphQL tools
Affected versions of this package are vulnerable to Prototype Pollution via mergeIncrementalResult when path segments are processed by setObjectKeyPath. An attacker can supply a path containing a non-primitive segment such as ["__proto__"], which bypasses the dangerous-key guard through type coercion and writes onto Object.prototype, corrupting the shared prototype chain for all objects in the 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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade @graphql-tools/utils to version 12.0.2 or higher.
References
high severity
- Vulnerable module: @graphql-tools/utils
- Introduced through: @nestjs/graphql@13.4.5
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › @nestjs/graphql@13.4.5 › @graphql-tools/utils@12.0.0Remediation: Upgrade to @nestjs/graphql@14.0.1.
Overview
@graphql-tools/utils is a Common package containing utils and types for GraphQL tools
Affected versions of this package are vulnerable to Prototype Pollution via the mergeDeep function, which fails to block reserved property keys such as __proto__, constructor, and prototype before recursively merging source objects into an output object. An attacker who controls a source object passed to mergeDeep can pollute Object.prototype, potentially affecting all objects in the process and enabling further exploitation.
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
Objectrecursive mergeProperty 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
Freeze the prototype— use
Object.freeze (Object.prototype).Require schema validation of JSON input.
Avoid using unsafe recursive merge functions.
Consider using objects without prototypes (for example,
Object.create(null)), breaking the prototype chain and preventing pollution.As a best practice use
Mapinstead ofObject.
For more information on this vulnerability type:
Arteau, Olivier. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018
Remediation
Upgrade @graphql-tools/utils to version 12.0.1 or higher.
References
medium severity
- Vulnerable module: minimatch
- Introduced through: sequelize-typescript@2.1.6
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › sequelize-typescript@2.1.6 › glob@7.2.0 › minimatch@3.1.5
Overview
minimatch is a minimal matching utility.
Affected versions of this package are vulnerable to Asymmetric Resource Consumption (Amplification) in the firstPhasePreProcess method, where the **/.. transform clones a globParts entry and pushes the clone back onto the same array inside a do...while (didSomething) fixpoint loop. An attacker can exhaust CPU and memory by supplying a glob pattern whose **/.. sequences regenerate entries during preprocessing, which secondPhasePreProcess then compares in an O(n^2) pairwise partsMatch pass over the expanded set. Exploitation requires the pattern to be parsed with optimizationLevel set to 2 or higher.
Remediation
Upgrade minimatch to version 11.0.1 or higher.
References
medium severity
new
- Vulnerable module: picomatch
- Introduced through: @nestjs/graphql@13.4.5 and typeorm@1.1.3
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › @nestjs/graphql@13.4.5 › tinyglobby@0.2.17 › picomatch@4.0.7
-
Introduced through: nestjs-query@tripss/nestjs-query › typeorm@1.1.3 › tinyglobby@0.2.17 › picomatch@4.0.7
Overview
Affected versions of this package are vulnerable to Incorrect Regular Expression via the globstar function in lib/parse.js, where globstar (**) patterns are compiled without the dotAll flag, causing the generated regular expression to use . which does not match line terminator characters. An attacker who controls file names, object keys, or archive entry names can embed newline characters in those names to evade **-based deny patterns, causing excluded resources to be included and exposed.
Remediation
A fix was pushed into the master branch but not yet published.
References
medium severity
new
- Vulnerable module: mongodb
- Introduced through: mongoose@9.11.4
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › mongoose@9.11.4 › mongodb@7.7.0Remediation: Upgrade to mongoose@9.13.0.
Overview
mongodb is an official MongoDB driver for Node.js.
Affected versions of this package are vulnerable to Improper Neutralization of Null Byte or NUL Character in the plain.js PLAIN authentication provider, which builds the SASL PLAIN message by joining the username and password with NUL separators without rejecting NUL characters inside either field. A user with valid credentials for one identity can authenticate as that identity instead of the one the application constructed, bypassing application-side identity checks such as an allow list or a required username suffix, by supplying a username containing NUL-separated authentication and password values. This affects only applications that use authMechanism: 'PLAIN' and build the username or password from less trusted input.
Workaround
This vulnerability can be avoided by rejecting any username or password that contains a NUL character (\0, or %00 in a connection string) before passing it to MongoClient.
Remediation
Upgrade mongodb to version 7.9.1 or higher.
References
medium severity
- Vulnerable module: uuid
- Introduced through: sequelize@6.37.8
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › sequelize@6.37.8 › uuid@8.3.2
Overview
uuid is a RFC4122 (v1, v4, and v5) compliant UUID library.
Affected versions of this package are vulnerable to Improper Validation of Specified Index, Position, or Offset in Input due to accepting external output buffers but not rejecting out-of-range writes (small buf or large offset). This inconsistency allows silent partial writes into caller-provided buffers.
PoC
cd /home/StrawHat/uuid
npm ci
npm run build
node --input-type=module -e "
import {v4,v5,v6} from './dist-node/index.js';
const ns='6ba7b810-9dad-11d1-80b4-00c04fd430c8';
for (const [name,fn] of [
['v4',()=>v4({},new Uint8Array(8),4)],
['v5',()=>v5('x',ns,new Uint8Array(8),4)],
['v6',()=>v6({},new Uint8Array(8),4)],
]) {
try { fn(); console.log(name,'NO_THROW'); }
catch(e){ console.log(name,'THREW',e.name); }
}"
Remediation
Upgrade uuid to version 11.1.1, 14.0.0 or higher.
References
medium severity
- Vulnerable module: inflight
- Introduced through: sequelize-typescript@2.1.6
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › sequelize-typescript@2.1.6 › glob@7.2.0 › 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
new
- Vulnerable module: mongodb
- Introduced through: mongoose@9.11.4
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › mongoose@9.11.4 › mongodb@7.7.0Remediation: Upgrade to mongoose@9.13.0.
Overview
mongodb is an official MongoDB driver for Node.js.
Affected versions of this package are vulnerable to Improper Restriction of Communication Channel to Intended Endpoints via OIDC ENVIRONMENT and callback confusion in MongoCredentials validation, where specifying both an ENVIRONMENT value and an OIDC_CALLBACK or OIDC_HUMAN_CALLBACK bypasses the ALLOWED_HOSTS restriction. A bearer token produced by the application's own login callback can therefore be transmitted to a host outside the configured set of permitted hosts, resulting in unintended disclosure of that credential.
Remediation
Upgrade mongodb to version 7.9.0 or higher.
References
medium severity
new
- Vulnerable module: mongodb
- Introduced through: mongoose@9.11.4
Detailed paths
-
Introduced through: nestjs-query@tripss/nestjs-query › mongoose@9.11.4 › mongodb@7.7.0Remediation: Upgrade to mongoose@9.13.0.
Overview
mongodb is an official MongoDB driver for Node.js.
Affected versions of this package are vulnerable to Information Exposure in the HostAddress class in utils.ts and the parseOptions function in connection_string.ts, which include connection-string components in the messages and cause of errors thrown during MongoClient construction and connection. An attacker with access to the application's logs can obtain database credentials when the application passes a connection string with credentials but no valid host, because the user:pass portion is parsed as host:port and appears in the resulting Unable to parse ... with URL error and its cause.input. This affects only applications that build connection strings from user or configuration input where a missing or malformed host can reach the driver, and that log driver errors or MongoClient instances.
Workaround
This vulnerability can be avoided by validating that connection strings contain a host before passing them to the driver, and by redacting the message and cause of errors raised during MongoClient construction or connection before logging them.
Remediation
Upgrade mongodb to version 7.9.1 or higher.