Vulnerabilities in pkg:npm/serve-static
PACKAGECVE-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.
pkg:npm/serve-static
Vulnerability advisories affecting package pkg:npm/serve-static. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-cm22-4g7w-348p | CVE-2024-43800 | LOW | serve-static vulnerable to template injection that can lead to XSS |
| GHSA-c3x7-gjmx-r2ff | CVE-2015-1164 | LOW | Open Redirect in serve-static |
CVE-2024-43800 at a Glance
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).
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.
npm install serve-static@1.16.0
npm install serve-static@2.1.0
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
CVE-2024-43800 Affected Serve static Versions
2 component(s)| 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?
Which Serve static versions are affected?
What version fixes CVE-2024-43800?
Is serve-static affected?
What is the CVSS score of CVE-2024-43800?
What CWE is associated with CVE-2024-43800?
How can I check npm dependencies for CVE-2024-43800?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}