Vulnerabilities in pkg:npm/fastify-static

PACKAGE
Advisory Identifier: GHSA-p6vg-p826-qp3v
Advisory Summary

CVE-2021-22963 is a MODERATE (CVSS 6.1) url redirection to untrusted site vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Fastify static libraries in the npm ecosystem. The issue involves url redirection to untrusted site ('open redirect') in fastify-static. Remediation is available by upgrading affected packages to version 4.2.4.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/fastify-static

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/fastify-static. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-p6vg-p826-qp3v CVE-2021-22963 MODERATE URL Redirection to Untrusted Site ('Open Redirect') in fastify-static
GHSA-pgh6-m65r-2rhq CVE-2021-22964 HIGH DOS and Open Redirect with user input

CVE-2021-22963 at a Glance

CVE Identifier CVE-2021-22963
GHSA Identifier GHSA-p6vg-p826-qp3v
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
Affected Product Fastify static
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2021-22963

To remediate this vulnerability, upgrade all affected Fastify static dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

fastify-static fixed: 4.2.4
npm install fastify-static@4.2.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls fastify-static

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2021-22963, inspect your project dependencies using npm:

npm ls fastify-static

Analyze the terminal output to locate any version of Fastify static in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.2.4), your application is affected.

Note: The npm ls fastify-static command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In Fastify static, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact A redirect vulnerability in the `fastify-static` module allows remote attackers to redirect Mozilla Firefox users to arbitrary websites via a double slash `//` followed by a domain: `http://localhost:3000//google.com/%2e%2e`. The issue shows up on all the `fastify-static` applications that set `redirect: true` option. By default, it is `false`. ### Patches The issue has been patched in `fastify-static@4.2.4` ### Workarounds If updating is not an option, you can sanitize the input URLs using the [`rewriteUrl`](https://www.fastify.io/docs/latest/Server/#rewriteurl) server option. ### References + Bug founder: drstrnegth + [hackerone Report](https://hackerone.com/reports/1354255) ### For more information If you have any questions or comments about this advisory: * Open an issue in [fastify-static](https://github.com/fastify/fastify-static) * Contact the [security team](https://github.com/fastify/fastify/blob/main/SECURITY.md#the-fastify-security-team)

CVE-2021-22963 Affected Fastify static Versions

1 component(s)
Fixed Versions:
4.2.4
Product / Package Ecosystem Affected Versions Fixed Version
fastify-static
npm
< 4.2.4
4.2.4

References

Frequently Asked Questions

What is CVE-2021-22963?
CVE-2021-22963 is a security vulnerability in Fastify static involving URL Redirection to Untrusted Site ('Open Redirect') in fastify-static under CWE-601: URL Redirection to Untrusted Site ('Open Redirect').
Which Fastify static versions are affected?
Affected versions include releases prior to 4.2.4 across affected packages: fastify-static.
What version fixes CVE-2021-22963?
Upgrading to 4.2.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fastify-static affected?
Yes, fastify-static is affected in releases prior to 4.2.4. Upgrade your dependency to 4.2.4 or later.
What is the CVSS score of CVE-2021-22963?
CVE-2021-22963 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2021-22963?
CVE-2021-22963 is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect') (The web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect.).
How can I check npm dependencies for CVE-2021-22963?
Run the dependency tree command: 'npm ls fastify-static'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-p6vg-p826-qp3v",
  "modified" : "2021-10-21T15:01:19Z",
  "published" : "2021-10-05T20:24:49Z",
  "aliases" : [ "CVE-2021-22963" ],
  "summary" : "URL Redirection to Untrusted Site ('Open Redirect') in fastify-static",
  "details" : "### Impact\n\nA redirect vulnerability in the `fastify-static` module allows remote attackers to redirect Mozilla Firefox users to arbitrary websites via a double slash `//` followed by a domain: `http://localhost:3000//google.com/%2e%2e`.\n\nThe issue shows up on all the `fastify-static` applications that set `redirect: true` option. By default, it is `false`.\n\n### Patches\nThe issue has been patched in `fastify-static@4.2.4`\n\n### Workarounds\nIf updating is not an option, you can sanitize the input URLs using the [`rewriteUrl`](https://www.fastify.io/docs/latest/Server/#rewriteurl) server option.\n\n### References\n\n+ Bug founder: drstrnegth\n+ [hackerone Report](https://hackerone.com/reports/1354255)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [fastify-static](https://github.com/fastify/fastify-static)\n* Contact the [security team](https://github.com/fastify/fastify/blob/main/SECURITY.md#the-fastify-security-team)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "fastify-static"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.2.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/fastify/fastify-static/security/advisories/GHSA-p6vg-p826-qp3v"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-22963"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/1354255"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/fastify/fastify-static"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-05T18:55:33Z",
    "nvd_published_at" : "2021-10-14T15:15:00Z"
  }
}