CVE-2024-43800
serve-static vulnerable to template injection that can lead to XSS
Description
Impact
passing untrusted user input - even after sanitizing it - to redirect() may execute untrusted code
Patches
this issue is patched in serve-static 1.16.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:
- The attacker MUST control the input to response.redirect()
- express MUST NOT redirect before the template appears
- the browser MUST NOT complete redirection before:
- the user MUST click on the link in the template
Affected Maven artifacts (2)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| org.mvnpm » serve-staticvia npm serve-static | < 1.16.0>= 2.0.0, < 2.1.0 | 1.16.0, 2.1.0 |
| org.webjars.npm » serve-staticvia npm serve-static | < 1.16.0>= 2.0.0, < 2.1.0 | 1.16.0, 2.1.0 |
Blast radius
33% of the dependent artifacts (2) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 8 |
| 2 hops | 3 |
Most used dependents
- org.webjars.npm » express38 usages
- org.mvnpm » express26 usages
- org.webjars.npm » browser-sync7 usages
- org.mvnpm » tailwind0 usages
- org.webjars.npm » ionic0 usages
- org.webjars.npm » reveal-md0 usages
Computed from the dependency graph of build 20261124.0621 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
Other ecosystems
Also affects npm (1 package) . See all on OSV
References
| Advisory | NVD CVE-2024-43800 | nvd.nist.gov |
| Package | expressjs/serve-static | github.com |
| Web | expressjs/serve-static advisory GHSA-cm22-4g7w-348p | github.com |
| Web | expressjs/serve-static commit 0c11fad | github.com |
| Web | expressjs/serve-static commit ce73089 | github.com |
