CVE-2024-32966: Static web server Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-rwfq-v4hq-h7fg
CVSS 5.8
CWE-80 CWE-79
Published
Advisory Summary

CVE-2024-32966 is a MODERATE (CVSS 5.8) cross-site scripting vulnerability (CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)) affecting Static web server libraries in the crates.io ecosystem. The issue involves static-web-server vulnerable to stored cross-site scripting in directory listings via file names. Remediation is available by upgrading affected packages to version 2.30.0.

CVE-2024-32966 at a Glance

CVE Identifier CVE-2024-32966
GHSA Identifier GHSA-rwfq-v4hq-h7fg
Severity MODERATE
CVSS v3.1 Base Score 5.8
CWE Classification CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)
Affected Product Static web server
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 5.8

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

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

How to Fix CVE-2024-32966

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

static-web-server fixed: 2.30.0
Upgrade static-web-server to 2.30.0
Verify Direct and Transitive Dependencies

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

inspect dependencies for static-web-server

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-32966, inspect your project dependencies for Static web server:

inspect dependencies for static-web-server

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages. In Static web server, 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

### Summary If directory listings are enabled for a directory that an untrusted user has upload privileges for, a malicious file name like `<img src=x onerror=alert(1)>.txt` will allow JavaScript code execution in the context of the web server’s domain. ### Details SWS generally does not perform escaping of HTML entities on any values inserted in the directory listing. At the very least `file_name` and `current_path` could contain malicious data however. `file_uri` could also be malicious but the relevant scenarios seem to be all caught by hyper. ### Impact For any web server that allow users to upload files or create directories under a name of their choosing this becomes a stored XSS vulnerability.

CVE-2024-32966 Affected Static web server Versions

1 component(s)
Fixed Versions:
2.30.0
Product / Package Ecosystem Affected Versions Fixed Version
static-web-server
crates.io
< 2.30.0
2.30.0

References

Frequently Asked Questions

What is CVE-2024-32966?
CVE-2024-32966 is a security vulnerability in Static web server involving static-web-server vulnerable to stored Cross-site Scripting in directory listings via file names under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS).
Which Static web server versions are affected?
Affected versions include releases prior to 2.30.0 across affected packages: static-web-server.
What version fixes CVE-2024-32966?
Upgrading to 2.30.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is static-web-server affected?
Yes, static-web-server is affected in releases prior to 2.30.0. Upgrade your dependency to 2.30.0 or later.
What is the CVSS score of CVE-2024-32966?
CVE-2024-32966 has a CVSS v3.1 base score of 5.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L.
What CWE is associated with CVE-2024-32966?
CVE-2024-32966 is classified under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) (The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages.).
How can I check crates.io dependencies for CVE-2024-32966?
Run the dependency tree command: 'inspect dependencies for static-web-server'. 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-rwfq-v4hq-h7fg",
  "modified" : "2024-05-01T16:39:24Z",
  "published" : "2024-05-01T16:39:24Z",
  "aliases" : [ "CVE-2024-32966" ],
  "summary" : "static-web-server vulnerable to stored Cross-site Scripting in directory listings via file names",
  "details" : "### Summary\nIf directory listings are enabled for a directory that an untrusted user has upload privileges for, a malicious file name like `<img src=x onerror=alert(1)>.txt` will allow JavaScript code execution in the context of the web server’s domain.\n\n### Details\nSWS generally does not perform escaping of HTML entities on any values inserted in the directory listing. At the very least `file_name` and `current_path` could contain malicious data however. `file_uri` could also be malicious but the relevant scenarios seem to be all caught by hyper.\n\n### Impact\nFor any web server that allow users to upload files or create directories under a name of their choosing this becomes a stored XSS vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "static-web-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.30.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/static-web-server/static-web-server/security/advisories/GHSA-rwfq-v4hq-h7fg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-32966"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/static-web-server/static-web-server"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/static-web-server/static-web-server/releases/tag/v2.30.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79", "CWE-80" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-01T16:39:24Z",
    "nvd_published_at" : "2024-05-01T06:15:21Z"
  }
}