CVE-2024-43800: Serve static Cross-Site Scripting Vulnerability

LOW
Advisory Identifier: GHSA-cm22-4g7w-348p
CVSS 5.0
CWE-79
Published
Advisory Summary

CVE-2024-43800 is a LOW (CVSS 5.0) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Serve static libraries in the npm ecosystem. The issue involves serve-static vulnerable to template injection that can lead to xss. Remediation is available by upgrading affected packages to version 1.16.0, 2.1.0.

CVE-2024-43800 at a Glance

CVE Identifier CVE-2024-43800
GHSA Identifier GHSA-cm22-4g7w-348p
Severity LOW
CVSS v3.1 Base Score 5.0
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Serve static
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.0

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:U/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 Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2024-43800

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

serve-static fixed: 1.16.0
npm install serve-static@1.16.0
serve-static fixed: 2.1.0
npm install serve-static@2.1.0
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 serve-static

How to Check if You Are Affected

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

npm ls serve-static

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

Note: The npm ls serve-static 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Serve static, 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

### Impact passing untrusted user input - even after sanitizing it - to `redirect()` may execute untrusted code ### Patches this issue is patched in serve-static 1.16.0 ### Workarounds users are encouraged to upgrade to the patched version of express, but otherwise can workaround this issue by making sure any untrusted inputs are safe, ideally by validating them against an explicit allowlist ### Details successful exploitation of this vector requires the following: 1. The attacker MUST control the input to response.redirect() 1. express MUST NOT redirect before the template appears 1. the browser MUST NOT complete redirection before: 1. the user MUST click on the link in the template

CVE-2024-43800 Affected Serve static Versions

2 component(s)
Fixed Versions:
1.16.02.1.0
Product / Package Ecosystem Affected Versions Fixed Version
serve-static
npm
< 1.16.0
1.16.0
serve-static
npm
≥ 2.0.0
< 2.1.0
2.1.0

References

Frequently Asked Questions

What is CVE-2024-43800?
CVE-2024-43800 is a security vulnerability in Serve static involving serve-static vulnerable to template injection that can lead to XSS under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Serve static versions are affected?
Affected versions include releases prior to 1.16.0, 2.1.0 across affected packages: serve-static.
What version fixes CVE-2024-43800?
Upgrading to 1.16.0, 2.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is serve-static affected?
Yes, serve-static is affected in releases prior to 1.16.0, 2.1.0. Upgrade your dependency to 1.16.0, 2.1.0 or later.
What is the CVSS score of CVE-2024-43800?
CVE-2024-43800 has a CVSS v3.1 base score of 5.0 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2024-43800?
CVE-2024-43800 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2024-43800?
Run the dependency tree command: 'npm ls serve-static'. 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-cm22-4g7w-348p",
  "modified" : "2024-11-18T16:27:11Z",
  "published" : "2024-09-10T19:42:33Z",
  "aliases" : [ "CVE-2024-43800" ],
  "summary" : "serve-static vulnerable to template injection that can lead to XSS",
  "details" : "### Impact\n\npassing untrusted user input - even after sanitizing it - to `redirect()` may execute untrusted code\n\n### Patches\n\nthis issue is patched in serve-static 1.16.0\n\n### Workarounds\n\nusers are encouraged to upgrade to the patched version of express, but otherwise can workaround this issue by making sure any untrusted inputs are safe, ideally by validating them against an explicit allowlist\n\n### Details\n\nsuccessful exploitation of this vector requires the following:\n\n1. The attacker MUST control the input to response.redirect()\n1. express MUST NOT redirect before the template appears\n1. the browser MUST NOT complete redirection before:\n1. the user MUST click on the link in the template\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "serve-static"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.16.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "serve-static"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/expressjs/serve-static/security/advisories/GHSA-cm22-4g7w-348p"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-43800"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/expressjs/serve-static/commit/0c11fad159898cdc69fd9ab63269b72468ecaf6b"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/expressjs/serve-static/commit/ce730896fddce1588111d9ef6fdf20896de5c6fa"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/expressjs/serve-static"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-09-10T19:42:33Z",
    "nvd_published_at" : "2024-09-10T15:15:17Z"
  }
}