CVE-2024-43796: Express Cross-Site Scripting Vulnerability
LOWCVE-2024-43796 is a LOW (CVSS 5.0) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Express libraries in the npm ecosystem. The issue involves express vulnerable to xss via response.redirect(). Remediation is available by upgrading affected packages to version 4.20.0, 5.0.0.
CVE-2024-43796 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-43796
To remediate this vulnerability, upgrade all affected Express 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 express@4.20.0
npm install express@5.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls express
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-43796, inspect your project dependencies using npm:
npm ls express
Analyze the terminal output to locate any version of Express in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.20.0), your application is affected.
Note: The npm ls express 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 Express, 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-43796 Affected Express Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
express
|
npm |
< 4.20.0
|
4.20.0
|
|
express
|
npm |
≥ 5.0.0-alpha.1
< 5.0.0
|
5.0.0
|
References
Frequently Asked Questions
What is CVE-2024-43796?
Which Express versions are affected?
What version fixes CVE-2024-43796?
Is express affected?
What is the CVSS score of CVE-2024-43796?
What CWE is associated with CVE-2024-43796?
How can I check npm dependencies for CVE-2024-43796?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qw6h-vgh9-j6wx",
"modified" : "2024-11-18T16:27:11Z",
"published" : "2024-09-10T19:41:04Z",
"aliases" : [ "CVE-2024-43796" ],
"summary" : "express vulnerable to XSS via response.redirect()",
"details" : "### Impact\n\nIn express <4.20.0, passing untrusted user input - even after sanitizing it - to `response.redirect()` may execute untrusted code\n\n### Patches\n\nthis issue is patched in express 4.20.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" : "express"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.20.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "express"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.0.0-alpha.1"
}, {
"fixed" : "5.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/expressjs/express/security/advisories/GHSA-qw6h-vgh9-j6wx"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-43796"
}, {
"type" : "WEB",
"url" : "https://github.com/expressjs/express/commit/54271f69b511fea198471e6ff3400ab805d6b553"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/expressjs/express"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2024-09-10T19:41:04Z",
"nvd_published_at" : "2024-09-10T15:15:17Z"
}
}