CVE-2024-39943: Hfs Rejetto HFS Vulnerable To OS Vulnerability

HIGH
Advisory Identifier: GHSA-5f4x-hwv2-w9w2
CVSS 9.9
CWE-78 CWE-284
Published
Advisory Summary

CVE-2024-39943 is a HIGH (CVSS 9.9) rejetto hfs vulnerable to os vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Hfs libraries in the npm ecosystem. The issue involves rejetto hfs vulnerable to os command execution by remote authenticated users. Remediation is available by upgrading affected packages to version 0.52.10.

CVE-2024-39943 at a Glance

CVE Identifier CVE-2024-39943
GHSA Identifier GHSA-5f4x-hwv2-w9w2
Severity HIGH
CVSS v3.1 Base Score 9.9
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Hfs
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-39943

To remediate this vulnerability, upgrade all affected Hfs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

hfs fixed: 0.52.10
npm install hfs@0.52.10
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls hfs

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-39943, inspect your project dependencies using npm:

npm ls hfs

Analyze the terminal output to locate any version of Hfs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.52.10), your application is affected.

Note: The npm ls hfs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product 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. In Hfs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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).

CVE-2024-39943 Affected Hfs Versions

1 component(s)
Fixed Versions:
0.52.10
Product / Package Ecosystem Affected Versions Fixed Version
hfs
npm
< 0.52.10
0.52.10

References

Frequently Asked Questions

What is CVE-2024-39943?
CVE-2024-39943 is a security vulnerability in Hfs involving rejetto HFS vulnerable to OS Command Execution by remote authenticated users under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Hfs versions are affected?
Affected versions include releases prior to 0.52.10 across affected packages: hfs.
What version fixes CVE-2024-39943?
Upgrading to 0.52.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is hfs affected?
Yes, hfs is affected in releases prior to 0.52.10. Upgrade your dependency to 0.52.10 or later.
What is the CVSS score of CVE-2024-39943?
CVE-2024-39943 has a CVSS v3.1 base score of 9.9 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2024-39943?
CVE-2024-39943 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product 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.).
How can I check npm dependencies for CVE-2024-39943?
Run the dependency tree command: 'npm ls hfs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5f4x-hwv2-w9w2",
  "modified" : "2024-11-18T16:26:49Z",
  "published" : "2024-07-05T00:31:07Z",
  "aliases" : [ "CVE-2024-39943" ],
  "summary" : "rejetto HFS vulnerable to OS Command Execution by remote authenticated users",
  "details" : "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).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "hfs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.52.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39943"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rejetto/hfs/commit/305381bd36eee074fb238b64302a252668daad1d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rejetto/hfs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rejetto/hfs/compare/v0.52.9...v0.52.10"
  }, {
    "type" : "WEB",
    "url" : "https://www.rejetto.com/wiki/index.php/HFS:_Working_with_uploads"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-284", "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-08T18:38:39Z",
    "nvd_published_at" : "2024-07-04T23:15:09Z"
  }
}