Medium

Express.js Open Redirect in malformed URLs

  • Disclosed: 25.03.2024
  • Updated: 11.10.2026 10:22

Impact

Versions 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.

When a user of Express performs a redirect using a user-provided URL Express performs an encode using 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.

The main method impacted is res.location() but this is also called from within res.redirect().

Patches

https://github.com/expressjs/express/commit/0867302ddbde0e9463d0564fea5861feb708c2dd https://github.com/expressjs/express/commit/0b746953c4bd8e377123527db11f9cd866e39f94

An 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.

Workarounds

The 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.

Resources

https://github.com/expressjs/express/pull/5539 https://github.com/koajs/koa/issues/1800 https://expressjs.com/en/4x/api.html#res.location

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package express < 4.19.2, >= 5.0.0-alpha.1, < 5.0.0-beta.3 4.19.2, 5.0.0-beta.3

References

CVSS score 6.1/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness (CWE)
CWE-1286, CWE-601
Platform
npm
Package
express
Disclosed
25.03.2024
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-rv95-896h-c2vc - CC BY 4.0

Vulnerability history: express

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
5
First → latest
10.2018 10.2024
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Medium 3
  • Low 2

Disclosures per year

  1. 2018: 1
  2. 2019: 0
  3. 2020: 0
  4. 2021: 0
  5. 2022: 0
  6. 2023: 0
  7. 2024: 4
  8. 2025: 0
  9. 2026: 0
  1. Medium · 4.0 CVE-2024-10491 < 4.0.0-rc1 4.0.0-rc1
  2. Low · 4.7 CVE-2024-9266 >= 3.4.5, < 4.0.0-rc1 4.0.0-rc1
  3. Low · 5.0 CVE-2024-43796 < 4.20.0, >= 5.0.0-alpha.1, < 5.0.0 4.20.0, 5.0.0
  4. Express.js Open Redirect in malformed URLs this entry
    Medium · 6.1 CVE-2024-29041 < 4.19.2, >= 5.0.0-alpha.1, < 5.0.0-beta.3 4.19.2, 5.0.0-beta.3
  5. Medium · 6.1 CVE-2014-6393 < 3.11.0, >= 4.0.0, < 4.5.0 3.11.0, 4.5.0

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.