Packages / express / Security

LowVulnerabilityGHSA-qw6h-vgh9-j6wxCVE-2024-43796Published 10 Sep 2024

express vulnerable to XSS via response.redirect()

Affected releases · express

  • 4.x4.0.0 – 4.19.2Fixed in 4.20.0
  • 3.x and older0.14.0 – 3.21.2No fix, no longer updated

On 4.x, the newest line:

npm install express@4.20.0
5.x
  1. Not affected

    5.0.0 – 5.3.0

    6 releases, latest

4.x
  1. Affected

    4.0.0 – 4.19.2

    87 releases

  2. Fixed

    4.20.0 – 4.22.3

    8 releases

3.x
  1. Affected

    3.0.0 – 3.21.2

    96 releases

2.x
  1. Affected

    2.0.0 – 2.5.11

    39 releases

1.x
  1. Affected

    1.0.0 – 1.0.8

    9 releases

0.x
  1. Affected

    0.14.0 – 0.14.1

    2 releases

247 stable releases of express, oldest to newest, one row per major.

Is your project affected?

Paste your package.json, or type the range you declare for express. It is read in your browser and sent nowhere.

What happens

Impact

In express <4.20.0, passing untrusted user input - even after sanitizing it - to response.redirect() may execute untrusted code

Patches

this issue is patched in express 4.20.0

Workarounds

users 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

Details

successful exploitation of this vector requires the following:

  1. The attacker MUST control the input to response.redirect()

  2. express MUST NOT redirect before the template appears

  3. the browser MUST NOT complete redirection before:

  4. the user MUST click on the link in the template