CVE-2021-21322: Fastify http proxy Prefix Escape Vulnerability

LOW
Advisory Identifier: GHSA-c4qr-gmr9-v23w
CVSS 10.0
CWE-20
Published
Advisory Summary

CVE-2021-21322 is a LOW (CVSS 10.0) prefix escape vulnerability (CWE-20: Improper Input Validation) affecting Fastify http proxy libraries in the npm ecosystem. The issue involves prefix escape. Remediation is available by upgrading affected packages to version 4.3.1.

CVE-2021-21322 at a Glance

CVE Identifier CVE-2021-21322
GHSA Identifier GHSA-c4qr-gmr9-v23w
Severity LOW
CVSS v3.1 Base Score 10.0
CWE Classification CWE-20: Improper Input Validation
Affected Product Fastify http proxy
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 10.0

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:N/S:C/C:H/I:H/A:N).

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

How to Fix CVE-2021-21322

To remediate this vulnerability, upgrade all affected Fastify http proxy 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-http-proxy fixed: 4.3.1
npm install fastify-http-proxy@4.3.1
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-http-proxy

How to Check if You Are Affected

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

npm ls fastify-http-proxy

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

Note: The npm ls fastify-http-proxy 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Fastify http proxy, 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 By crafting a specific URL, it is possible to escape the prefix of the proxied backend service. If the base url of the proxied server is `/pub/`, a user expect that accessing `/priv` on the target service would not be possible. Unfortunately, it is. [CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N) ### Patches All releases after v4.3.1 include the fix. ### Workarounds There are no workaround available. ### For more information If you have any questions or comments about this advisory: * Open an issue in [fastify-reply-from](https://github.com/fastify/fastify-reply-from) * Email us at [hello@matteocollina.com](mailto:hello@matteocollina.com)

CVE-2021-21322 Affected Fastify http proxy Versions

1 component(s)
Fixed Versions:
4.3.1
Product / Package Ecosystem Affected Versions Fixed Version
fastify-http-proxy
npm
< 4.3.1
4.3.1

References

Frequently Asked Questions

What is CVE-2021-21322?
CVE-2021-21322 is a security vulnerability in Fastify http proxy involving Prefix escape under CWE-20: Improper Input Validation.
Which Fastify http proxy versions are affected?
Affected versions include releases prior to 4.3.1 across affected packages: fastify-http-proxy.
What version fixes CVE-2021-21322?
Upgrading to 4.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fastify-http-proxy affected?
Yes, fastify-http-proxy is affected in releases prior to 4.3.1. Upgrade your dependency to 4.3.1 or later.
What is the CVSS score of CVE-2021-21322?
CVE-2021-21322 has a CVSS v3.1 base score of 10.0 (LOW) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2021-21322?
CVE-2021-21322 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2021-21322?
Run the dependency tree command: 'npm ls fastify-http-proxy'. 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-c4qr-gmr9-v23w",
  "modified" : "2021-03-02T03:32:25Z",
  "published" : "2021-03-03T02:18:08Z",
  "aliases" : [ "CVE-2021-21322" ],
  "summary" : "Prefix escape",
  "details" : "### Impact\n\nBy crafting a specific URL, it is possible to escape the prefix of the proxied backend service.\nIf the base url of the proxied server is `/pub/`, a user expect that accessing `/priv` on the target service would not be possible. Unfortunately, it is.\n\n[CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N)\n\n### Patches\n\nAll releases after v4.3.1 include the fix.\n\n### Workarounds\n\nThere are no workaround available.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [fastify-reply-from](https://github.com/fastify/fastify-reply-from)\n* Email us at [hello@matteocollina.com](mailto:hello@matteocollina.com)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "fastify-http-proxy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.3.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/fastify/fastify-http-proxy/security/advisories/GHSA-c4qr-gmr9-v23w"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21322"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fastify/fastify-http-proxy/commit/02d9b43c770aa16bc44470edecfaeb7c17985016"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/fastify-http-proxy"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-02T03:32:25Z",
    "nvd_published_at" : "2021-03-02T04:15:00Z"
  }
}