Vulnerabilities |
10 via 14 paths |
|---|---|
Dependencies |
361 |
Source |
GitHub |
Find, fix and prevent vulnerabilities in your code.
critical severity
new
- Vulnerable module: node-forge
- Introduced through: @parse/push-adapter@8.6.0
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › @parse/push-adapter@8.6.0 › @parse/node-apn@8.2.0 › node-forge@1.4.2
Overview
node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.
Affected versions of this package are vulnerable to Improper Certificate Validation via pki.verifyCertificateChain() in lib/x509.js, which does not decode or enforce the X.509 nameConstraints extension (OID 2.5.29.30) during certificate path validation. A certificate authority whose nameConstraints extension is marked non-critical can issue a leaf certificate with a subjectAltName dNSName or subject commonName outside its permitted subtrees or inside its excluded subtrees, and the chain passes verification. This allows an attacker holding such a CA's private key, or able to obtain a certificate issued under it, to impersonate arbitrary names - including in TLS peer verification via forge.tls - defeating the namespace restriction the constraint was intended to enforce.
Note: This is only exploitable when a name-constrained CA with a non-critical nameConstraints extension chains to a root trusted by the application, and the attacker controls that CA's private key or can obtain an out-of-scope certificate from it. Chains without nameConstraints are unaffected, and chains with a critical nameConstraints extension were already rejected.
Workaround
Pass an options.verify callback to pki.verifyCertificateChain() (or verify to forge.tls.createConnection()) that returns an error when any CA certificate in the chain has an extension with id 2.5.29.30. This rejects all chains below a name-constrained CA, including valid ones. Trust anchors with the extension must be checked separately.
Remediation
Upgrade node-forge to version 1.4.3 or higher.
References
high severity
new
- Vulnerable module: @graphql-tools/utils
- Introduced through: @graphql-tools/utils@11.2.2, @graphql-tools/merge@9.1.7 and others
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › @graphql-tools/utils@11.2.2Remediation: Upgrade to @graphql-tools/utils@12.0.2.
-
Introduced through: parse-server@parse-community/parse-server › @graphql-tools/merge@9.1.7 › @graphql-tools/utils@11.2.2Remediation: Upgrade to @graphql-tools/merge@9.2.3.
-
Introduced through: parse-server@parse-community/parse-server › @graphql-tools/schema@10.0.31 › @graphql-tools/utils@11.2.2Remediation: Upgrade to @graphql-tools/schema@10.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: @graphql-tools/utils@11.2.2, @graphql-tools/merge@9.1.7 and others
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › @graphql-tools/utils@11.2.2Remediation: Upgrade to @graphql-tools/utils@12.0.1.
-
Introduced through: parse-server@parse-community/parse-server › @graphql-tools/merge@9.1.7 › @graphql-tools/utils@11.2.2Remediation: Upgrade to @graphql-tools/merge@9.2.3.
-
Introduced through: parse-server@parse-community/parse-server › @graphql-tools/schema@10.0.31 › @graphql-tools/utils@11.2.2Remediation: Upgrade to @graphql-tools/schema@10.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 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
high severity
new
- Vulnerable module: follow-redirects
- Introduced through: follow-redirects@1.16.0
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › follow-redirects@1.16.0Remediation: Upgrade to follow-redirects@1.16.1.
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
- Vulnerable module: follow-redirects
- Introduced through: follow-redirects@1.16.0
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › follow-redirects@1.16.0Remediation: Upgrade to follow-redirects@1.16.2.
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
new
- Vulnerable module: node-forge
- Introduced through: @parse/push-adapter@8.6.0
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › @parse/push-adapter@8.6.0 › @parse/node-apn@8.2.0 › node-forge@1.4.2
Overview
node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.
Affected versions of this package are vulnerable to NULL Pointer Dereference via tls.handleHandshake() in lib/tls.js, which attempts to update handshake digests via c.session.md5.update(bytes) when c.session is null. A client's session is set to null by c.reset() after a close_notify alert or a call to close(), and is also absent before handshake() is called. A malicious server or an on-path attacker can send a ServerHello record in any of these states, causing an uncaught TypeError to propagate out of connection.process() and terminate the Node.js process.
Note: Only forge.tls clients are affected; servers are not vulnerable because a server creates its session upon receiving a ClientHello.
PoC
var c = forge.tls.createConnection({server: false, ...});
c.handshake();
// warning close_notify alert, then an empty ServerHello, in separate
// process() calls
c.process(forge.util.hexToBytes('15030100020100'));
c.process(forge.util.hexToBytes('160301000402000000'));
// <= 1.4.2: TypeError: Cannot read properties of null (reading 'md5')
// 1.4.3: the record is ignored
The reporter's PoC is in tests/pocs/ghsa-j8rw-jp99-435v.js, and regression tests are in tests/unit/tls.js.
Remediation
Upgrade node-forge to version 1.4.3 or higher.
References
high severity
new
- Vulnerable module: node-forge
- Introduced through: @parse/push-adapter@8.6.0
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › @parse/push-adapter@8.6.0 › @parse/node-apn@8.2.0 › node-forge@1.4.2
Overview
node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via _trimString() in lib/http.js, which removes trailing whitespace using the regular expression /\s*$/. On a string of n whitespace characters followed by a non-whitespace character, the engine attempts a match at each position and scans the remainder of the run each time, producing O(n^2) work. forge.http calls _trimString() on every response header value processed by response.readHeader() and on cookie names and values in response.getCookies(), with no limit on header size. A server or on-path attacker can send a large response header that blocks the client's event loop for minutes, denying service to everything else in the process.
Note: This is only exploitable by applications that use forge.http directly; forge.http is not loaded by require('node-forge') and requires a socket pool provided by the application.
Workaround
Limit the size of HTTP response headers before passing them to forge.http, for example in the socket pool's data handler.
PoC
var response = forge.http.createResponse();
var ws = new Array(40001).join('\t ');
response.readHeader(forge.util.createBuffer(
'HTTP/1.1 200 OK\r\nX-A: a' + ws + 'X\r\n\r\n'));
// <= 1.4.2: about 4 seconds (quadratic in the whitespace length)
// 1.4.3: about 1 ms
Regression tests are in tests/security/ghsa-6cv4-p8m7-4r25.js.
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:
AThe 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.DFinally, 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:
- CCC
- CC+C
- C+CC
- 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 node-forge to version 1.4.3 or higher.
References
high severity
new
- Vulnerable module: node-forge
- Introduced through: @parse/push-adapter@8.6.0
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › @parse/push-adapter@8.6.0 › @parse/node-apn@8.2.0 › node-forge@1.4.2
Overview
node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.
Affected versions of this package are vulnerable to Uncaught Exception via tls.parseHelloMessage() in lib/tls.js, which stores the ServerHello's compression_method without validating it against the methods offered in the ClientHello. When the client subsequently handles ServerHelloDone, tls.createConnectionState() throws an uncaught Error('Unsupported compression algorithm.') for any compression method other than null (0) or deflate (1). Because the ServerHello is not yet authenticated at this point, a malicious server or an on-path attacker can set the compression byte to an unsupported value, causing connection.process() to throw and terminating the Node.js process in applications that do not catch the exception - including those using forge.tls.wrapSocket or forge.http.
Workaround
Catch exceptions thrown by connection.process() and close the socket.
PoC
A server (or on-path attacker) sends a ServerHello with `compression_method` 0xff, followed by a valid Certificate and ServerHelloDone:
client.handshake();
client.process(serverHello + certificate + serverHelloDone);
// <= 1.4.2: throws Error: Unsupported compression algorithm.
// 1.4.3: error callback with "Unsupported compression method."
The reporter's PoC (a CA-issued server certificate and the default verify callback) is in tests/pocs/ghsa-w4xr-hqv8-ch44.js, and regression tests are in tests/unit/tls.js.
Remediation
Upgrade node-forge to version 1.4.3 or higher.
References
medium severity
new
- Vulnerable module: follow-redirects
- Introduced through: follow-redirects@1.16.0
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › follow-redirects@1.16.0Remediation: Upgrade to follow-redirects@1.16.1.
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
- Vulnerable module: node-forge
- Introduced through: @parse/push-adapter@8.6.0
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › @parse/push-adapter@8.6.0 › @parse/node-apn@8.2.0 › node-forge@1.4.2
Overview
node-forge is a JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.
Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature via ed25519.verify() in lib/ed25519.js, which does not reject public keys of small order. crypto_sign_open() decodes the public key A with unpackneg(), which only checks that the point is on the curve, and never validates that the key is not a small-order point (the identity point or the other 7 points of order 2, 4, or 8, including non-canonical encodings with y >= p). An attacker who can supply the public key can present a small-order key together with a signature where S = 0 and a small-order R, causing the verification equation R == [k](-A) to hold for many or all messages without knowledge of any private key. For the identity key specifically, the fixed signature R = identity, S = 0 verifies for every message.
PoC
Identity public key `A = 01 00 … 00` (32 bytes) and signature `R = 01 00 … 00`, `S = 00 … 00` (64 bytes):
forge.ed25519.verify({message: 'admin=true', encoding: 'utf8',
signature: SIG, publicKey: IDENTITY});
// <= 1.4.2: true for any message; node:crypto.verify(): false
// 1.4.3: false
Other small-order public keys (orders 2, 4 and 8, and non-canonical encodings) give forgeries for many messages with `S = 0` and a small-order `R`.
Regression tests are in tests/unit/ed25519.js, and the reporter's PoC is in tests/pocs/ghsa-6889-vf6x-f3g5.js.
Remediation
Upgrade node-forge to version 1.4.3 or higher.
References
medium severity
- Module: web-push
- Introduced through: @parse/push-adapter@8.6.0
Detailed paths
-
Introduced through: parse-server@parse-community/parse-server › @parse/push-adapter@8.6.0 › web-push@3.6.7
MPL-2.0 license