{"id":"GHSA-rv95-896h-c2vc","revision":"d685fa7b90a3407f8043107ba0e38224","records":[{"revision":"d685fa7b90a3407f8043107ba0e38224","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-rv95-896h-c2vc","aliases":["CVE-2024-29041"],"title":"Express.js Open Redirect in malformed URLs","description":"### 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","state":0,"publishedAt":"2024-03-25T19:40:26+00:00","modifiedAt":"2026-09-10T03:50:10.7500685+00:00","affected":[{"ecosystem":"npm","name":"express","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"4.19.2"}]}],"versions":[],"rawVersionEvidence":null},{"ecosystem":"npm","name":"express","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"5.0.0-alpha.1"},{"kind":"fixed","version":"5.0.0-beta.3"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"MODERATE"}],"references":["https://github.com/expressjs/express/security/advisories/GHSA-rv95-896h-c2vc","https://nvd.nist.gov/vuln/detail/CVE-2024-29041","https://github.com/koajs/koa/issues/1800","https://github.com/expressjs/express/pull/5539","https://github.com/expressjs/express/commit/0867302ddbde0e9463d0564fea5861feb708c2dd","https://github.com/expressjs/express/commit/0b746953c4bd8e377123527db11f9cd866e39f94","https://expressjs.com/en/4x/api.html#res.location","https://github.com/expressjs/express"],"sourceUrl":"https://github.com/advisories/GHSA-rv95-896h-c2vc","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-rv95-896h-c2vc","identifiers":["GHSA-rv95-896h-c2vc","CVE-2024-29041"]},"retained":false,"historicalAffected":[]}],"coverage":[]}