# CVE-2024-39943: rejetto HFS vulnerable to OS Command Execution by remote authenticated users

> Remote authenticated users with upload permissions can execute OS commands via shell execution of df in HFS.

- **Severity:** Critical 9.9 (`CVSS:3.1/AC:L/AV:N/A:H/C:H/I:H/PR:L/S:C/UI:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 4 Jul 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-5f4x-hwv2-w9w2

## What is CVE-2024-39943?

CVE-2024-39943 is a critical command injection vulnerability in n/a, published on 4 Jul 2024. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

rejetto HFS (aka HTTP File Server) 3 before 0.52.10 on Linux, UNIX, and macOS allows OS command execution by remote authenticated users (if they have Upload permissions). This occurs because a shell is used to execute df (i.e., with execSync instead of spawnSync in child_process in Node.js).

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command), CWE-284 (Improper Access Control)

## Which versions are affected by CVE-2024-39943?

2 open source packages ship an affected version, including hfs. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `hfs` | npm | All versions | 0.52.10 |
| `hfs` | npm | All versions | 0.52.10 |

Products: Rejetto Http File Server.

## How do I fix CVE-2024-39943?

Upgrade hfs to 0.52.10 or later.

## Is CVE-2024-39943 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-39943 exists.

Public exploit code:

- CVE-2024-39943 rejetto HFS (aka HTTP File Server) 3 before 0.52.10 on Linux, UNIX, and macOS allows OS command execution by remote authenticated users (if they have Upload permissions). This occurs because a shell is used to execute df (i.e., with execSync instead of spawnSync in child_process in Node.js). (github_poc): https://github.com/Heyholiday067/CVE-2024-39943-Poc
- https://github.com/JenmrR/Node.js-CVE-2024-39943 (github_poc): https://github.com/JenmrR/Node.js-CVE-2024-39943

## Other vulnerabilities in n/a

- [CVE-2024-23692](https://insights.sbomify.com/CVE-2024-23692/): Rejetto HTTP File Server Improper Neutralization of Special Elements Used in a Template Engine (critical 9.8, exploited in the wild)
- [CVE-2014-6287](https://insights.sbomify.com/CVE-2014-6287/): Rejetto HTTP File Server (HFS) Remote Code Execution (critical 9.8, exploited in the wild)
- [CVE-2020-13432](https://insights.sbomify.com/CVE-2020-13432/): Memory corruption in n/a (high 7.5)
- [CVE-2014-7226](https://insights.sbomify.com/CVE-2014-7226/): Code injection in n/a (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-39943 and fix it if it is affected.

What it is: CVE-2024-39943 is a critical command injection vulnerability in n/a, published on 4 Jul 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-39943 exists.

Affected packages and fixed versions:
- hfs (npm): affected all versions; fixed in 0.52.10
- hfs (npm): affected all versions; fixed in 0.52.10

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-39943/ (Markdown: https://insights.sbomify.com/CVE-2024-39943/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-39943
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-39943
- OSV: https://osv.dev/vulnerability/CVE-2024-39943

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-39943/
Summaries are generated and may contain mistakes; the official description above is the record.
