Junglewise Threat Intelligence

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

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

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

Executive brief

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.

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

Timeline

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

References

Related threats