Vulnerabilities in pkg:npm/express
PACKAGECVE-2024-29041 is a MODERATE (CVSS 6.1) express.js open redirect vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Express libraries in the npm ecosystem. The issue involves express.js open redirect in malformed urls. Remediation is available by upgrading affected packages to version 4.19.2, 5.0.0-beta.3.
pkg:npm/express
Vulnerability advisories affecting package pkg:npm/express. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-rv95-896h-c2vc | CVE-2024-29041 | MODERATE | Express.js Open Redirect in malformed URLs |
| GHSA-pj86-cfqh-vqx6 | CVE-2024-51999 | LOW | Withdrawn Advisory: express improperly controls modification of query properties |
| GHSA-cm5g-3pgc-8rg4 | CVE-2024-10491 | MODERATE | Express ressource injection |
| GHSA-qw6h-vgh9-j6wx | CVE-2024-43796 | LOW | express vulnerable to XSS via response.redirect() |
| GHSA-jj78-5fmv-mv28 | CVE-2024-9266 | LOW | Express Open Redirect vulnerability |
| GHSA-gpvr-g6gh-9mc2 | CVE-2014-6393 | MODERATE | No Charset in Content-Type Header in express |
CVE-2024-29041 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2024-29041
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.19.2
npm install express@5.0.0-beta.3
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-29041, 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.19.2), 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-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. 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-29041 Affected Express Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
express
|
npm |
< 4.19.2
|
4.19.2
|
|
express
|
npm |
≥ 5.0.0-alpha.1
< 5.0.0-beta.3
|
5.0.0-beta.3
|
References
Frequently Asked Questions
What is CVE-2024-29041?
Which Express versions are affected?
What version fixes CVE-2024-29041?
Is express affected?
What is the CVSS score of CVE-2024-29041?
What CWE is associated with CVE-2024-29041?
How can I check npm dependencies for CVE-2024-29041?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rv95-896h-c2vc",
"modified" : "2025-12-20T00:09:30Z",
"published" : "2024-03-25T19:40:26Z",
"aliases" : [ "CVE-2024-29041" ],
"summary" : "Express.js Open Redirect in malformed URLs",
"details" : "### Impact\n\nVersions of Express.js prior to 4.19.2 and pre-release alpha and beta versions before 5.0.0-beta.3 are affected by an open redirect vulnerability using malformed URLs.\n\nWhen a user of Express performs a redirect using a user-provided URL Express performs an encode [using `encodeurl`](https://github.com/pillarjs/encodeurl) on the contents before passing it to the `location` header. This can cause malformed URLs to be evaluated in unexpected ways by common redirect allow list implementations in Express applications, leading to an Open Redirect via bypass of a properly implemented allow list.\n\nThe main method impacted is `res.location()` but this is also called from within `res.redirect()`.\n\n### Patches\n\nhttps://github.com/expressjs/express/commit/0867302ddbde0e9463d0564fea5861feb708c2dd\nhttps://github.com/expressjs/express/commit/0b746953c4bd8e377123527db11f9cd866e39f94\n\nAn initial fix went out with `express@4.19.0`, we then patched a feature regression in `4.19.1` and added improved handling for the bypass in `4.19.2`.\n\n### Workarounds\n\nThe fix for this involves pre-parsing the url string with either `require('node:url').parse` or `new URL`. These are steps you can take on your own before passing the user input string to `res.location` or `res.redirect`.\n\n### Resources\n\nhttps://github.com/expressjs/express/pull/5539\nhttps://github.com/koajs/koa/issues/1800\nhttps://expressjs.com/en/4x/api.html#res.location",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "express"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.19.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "express"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.0.0-alpha.1"
}, {
"fixed" : "5.0.0-beta.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/expressjs/express/security/advisories/GHSA-rv95-896h-c2vc"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-29041"
}, {
"type" : "WEB",
"url" : "https://github.com/koajs/koa/issues/1800"
}, {
"type" : "WEB",
"url" : "https://github.com/expressjs/express/pull/5539"
}, {
"type" : "WEB",
"url" : "https://github.com/expressjs/express/commit/0867302ddbde0e9463d0564fea5861feb708c2dd"
}, {
"type" : "WEB",
"url" : "https://github.com/expressjs/express/commit/0b746953c4bd8e377123527db11f9cd866e39f94"
}, {
"type" : "WEB",
"url" : "https://expressjs.com/en/4x/api.html#res.location"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/expressjs/express"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1286", "CWE-601" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-03-25T19:40:26Z",
"nvd_published_at" : "2024-03-25T21:15:46Z"
}
}