CVE-2021-21321: Fastify reply from Prefix Escape Vulnerability
CRITICALCVE-2021-21321 is a CRITICAL (CVSS 10.0) prefix escape vulnerability (CWE-20: Improper Input Validation) affecting Fastify reply from libraries in the npm ecosystem. The issue involves prefix escape. Remediation is available by upgrading affected packages to version 4.0.2.
CVE-2021-21321 at a Glance
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).
How to Fix CVE-2021-21321
To remediate this vulnerability, upgrade all affected Fastify reply from dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install fastify-reply-from@4.0.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls fastify-reply-from
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-21321, inspect your project dependencies using npm:
npm ls fastify-reply-from
Analyze the terminal output to locate any version of Fastify reply from in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.2), your application is affected.
Note: The npm ls fastify-reply-from 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 reply from, 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
CVE-2021-21321 Affected Fastify reply from Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
fastify-reply-from
|
npm |
< 4.0.2
|
4.0.2
|
References
Frequently Asked Questions
What is CVE-2021-21321?
Which Fastify reply from versions are affected?
What version fixes CVE-2021-21321?
Is fastify-reply-from affected?
What is the CVSS score of CVE-2021-21321?
What CWE is associated with CVE-2021-21321?
How can I check npm dependencies for CVE-2021-21321?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qmw8-3v4g-gwj4",
"modified" : "2021-03-02T03:32:13Z",
"published" : "2021-03-03T01:52:05Z",
"aliases" : [ "CVE-2021-21321" ],
"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\nA patch have been submitted by Corey Farrell git@cfware.com, the reporter.\nAll releases after v4.0.2 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-reply-from"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.0.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify-reply-from/security/advisories/GHSA-qmw8-3v4g-gwj4"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-21321"
}, {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify-reply-from/commit/dea227dda606900cc01870d08541b4dcc69d3889"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/fastify-reply-from"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2021-03-02T03:32:13Z",
"nvd_published_at" : "2021-03-02T04:15:00Z"
}
}