# CVE-2021-21321: fastify-reply-from prefix escape in URL routing

Source: https://junglewise.ai/threats/cve-2021-21321-fastify-reply-from-prefix-escape-in-url-routing  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2021-03-03. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2021-21321 · Severity: low · CVSS 3.1 · Published 2021-03-03

fastify-reply-from is a Fastify plugin that forwards HTTP requests to a proxied backend service. A flaw allows attackers to craft specific URLs that bypass the configured URL prefix restriction, potentially accessing restricted backend resources that should be protected behind the proxy. This could expose sensitive endpoints that administrators intended to keep private.

Technologies: [@fastify/reply-from (npm)](https://junglewise.ai/threats/technologies/fastify-reply-from). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2021-21321 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2021-21321 being exploited in the wild.

**How severe is CVE-2021-21321?** Low severity, with a CVSS score of 3.1, published 3 March 2021.

**Which products and versions are affected?** @fastify/reply-from (npm) SEMVER:introduced=0,fixed=4.0.2.

**Is there a fix for CVE-2021-21321?** Yes. @fastify/reply-from (npm): upgrade to 4.0.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2021-21321 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2021-21321?** Check whether you run @fastify/reply-from (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- @fastify/reply-from (npm): upgrade to 4.0.2 or later

  ```sh
  npm install @fastify/reply-from@4.0.2
  ```


## Technical details

A path traversal/escape vulnerability exists in fastify-reply-from's URL routing logic that fails to properly validate and enforce the configured prefix boundary when forwarding requests to the proxied backend. An attacker can craft a malicious URL that escapes the intended prefix constraint—for example, if the proxy is configured to only allow access to /pub/ on the backend, an attacker can access /priv/ by bypassing the prefix check. The vulnerability requires no authentication and is remotely exploitable over the network. All versions prior to 4.0.2 are affected; patches are available in v4.0.2 and later.

## Affected products

- Fastify fastify-reply-from all versions prior to 4.0.2

## Identifiers

- CVE-2021-21321
- GHSA-qmw8-3v4g-gwj4

## Timeline

- 2021-02-23: disclosed
- 2021-03-03: advisory
- 2021-03-02: patched: v4.0.2 and later include the fix

## References

- [https://github.com/fastify/fastify-reply-from/security/advisories/GHSA-qmw8-3v4g-gwj4](https://github.com/fastify/fastify-reply-from/security/advisories/GHSA-qmw8-3v4g-gwj4)

## Related threats

- [Fastify proxy components header stripping via Connection header abuse](https://junglewise.ai/threats/cve-2026-33805-fastify-proxy-components-header-stripping-via-connection-header)
- [Fastify reply-from route bypass using path traversal](https://junglewise.ai/threats/cve-2025-66415-fastify-fastify-reply-from-reply-forwarding-bypass)
- [@fastify/reply-from JSON Content-Type parsing confusion](https://junglewise.ai/threats/cve-2023-51701-fastify-reply-from-json-content-type-parsing-confusion)
