CVE-2021-21321: Prefix escape
10
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.6278%
CWE
Published
3/3/2021
Updated
2/1/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
fastify-reply-from | npm | < 4.0.2 | 4.0.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper path validation in URL construction. The commit dea227d shows the fix was applied to the buildURL
function in lib/utils.js
, where they added logic to: 1) Ensure base URLs get trailing slashes, and 2) Validate the full destination URL starts with the normalized base. The pre-patch code only checked origin matching (reqBase.startsWith(dest.origin)
), which failed to prevent path escapes when base URLs lacked trailing slashes. The added test cases in test/build-url.js
demonstrate scenarios where crafted URLs could bypass the prefix restriction before the fix.