CVE-2021-22964: fastify-static open redirect and DOS with user input

CVE-2021-22964 · Severity: low · CVSS 3.1 · Published 2021-10-12

fastify-static is a Fastify plugin that serves static files and can optionally redirect requests. When the redirect option is enabled, the module fails to properly validate user-supplied URLs, allowing attackers to redirect users to arbitrary websites or trigger denial-of-service conditions by including malicious input like double slashes or invalid characters in the request path.

Technologies: @fastify/static (npm). Vendors: npm.

Quick answers

Is CVE-2021-22964 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2021-22964 being exploited in the wild.
How severe is CVE-2021-22964?
Low severity, with a CVSS score of 3.1, published 12 October 2021.
Which products and versions are affected?
@fastify/static (npm) SEMVER:introduced=4.2.4,fixed=4.4.1.
Is there a fix for CVE-2021-22964?
Yes. @fastify/static (npm): upgrade to 4.4.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2021-22964 attacked?
It is attacked over the network.
Am I affected by CVE-2021-22964?
Check whether you run @fastify/static (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • @fastify/static (npm): upgrade to 4.4.1 or later
    npm install @fastify/static@4.4.1

Technical details

fastify-static versions 4.2.4 through 4.4.0 contain an open redirect vulnerability (CWE-601) and denial-of-service vulnerability (CWE-248) when the redirect option is enabled. The vulnerability stems from improper URL validation and path normalization in the redirect handler. An attacker can craft a malicious URL using double slashes (e.g., //a//youtube.com/) or invalid characters (e.g., //^/..) to either redirect users in Mozilla Firefox to attacker-controlled domains or cause the application to throw an uncaught exception resulting in a denial of service. The attack requires user interaction (clicking a malicious link) but affects all applications with redirect: true configured. The vulnerability has been patched in version 4.4.1 and can be mitigated by disabling redirects or sanitizing input URLs with the rewriteUrl option.

Affected products

  • Fastify fastify-static 4.2.4 to 4.4.0

Identifiers

  • CVE-2021-22964
  • GHSA-pgh6-m65r-2rhq

Timeline

  • 2021-10-11: disclosed
  • 2021-10-11: patched: fastify-static 4.4.1

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.