Vulnerabilities in pkg:npm/@fastify/reply-from

PACKAGE
Advisory Identifier: GHSA-gwhp-pf74-vj37
Advisory Summary

CVE-2026-33805 is a CRITICAL (CVSS 8.6) fastify's connection header abuse enables vulnerability (CWE-644: Improper Neutralization of HTTP Headers for Scripting Syntax) affecting @fastify/reply from libraries in the npm ecosystem. The issue involves fastify's connection header abuse enables stripping of proxy-added headers. Remediation is available by upgrading affected packages to version 12.6.2, 11.4.4.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@fastify/reply-from

3 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-gwhp-pf74-vj37 CVE-2026-33805 CRITICAL Fastify's connection header abuse enables stripping of proxy-added headers
GHSA-2q7r-29rg-6m5h CVE-2025-66415 MODERATE fastify-reply-from affected by bypass of reply forwarding
GHSA-v2v2-hph8-q5xp CVE-2023-51701 MODERATE @fastify/reply-from JSON Content-Type parsing confusion

CVE-2026-33805 at a Glance

CVE Identifier CVE-2026-33805
GHSA Identifier GHSA-gwhp-pf74-vj37
Severity CRITICAL
CVSS v3.1 Base Score 8.6
CWE Classification CWE-644: Improper Neutralization of HTTP Headers for Scripting Syntax
Affected Product @fastify/reply from
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.6

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:N/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 None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-33805

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.

@fastify/reply-from fixed: 12.6.2
npm install @fastify/reply-from@12.6.2
@fastify/http-proxy fixed: 11.4.4
npm install @fastify/http-proxy@11.4.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/reply-from

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-33805, 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 12.6.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-644: Improper Neutralization of HTTP Headers for Scripting Syntax, where the product does not neutralize or incorrectly neutralizes web scripting syntax in http headers that can be used by web browser components that can process raw headers, such as flash. 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

### Summary `@fastify/reply-from` and `@fastify/http-proxy` process the client's `Connection` header after the proxy has added its own headers via `rewriteRequestHeaders`. This allows attackers to retroactively strip proxy-added headers (like access control or identification headers) from upstream requests by listing them in the `Connection` header value. This affects applications using these plugins with custom header injection for routing, access control, or security purposes. ### Details The vulnerability exists in `@fastify/reply-from/lib/request.js` at lines 128-136 (HTTP/1.1 handler) and lines 191-200 (undici handler). The processing flow is: 1. Client headers are copied including the `connection` header (`@fastify/reply-from/index.js` line 91) 2. The proxy adds custom headers via `rewriteRequestHeaders` (line 151) 3. During request construction, the transport handlers read the client's `Connection` header and strip any headers listed in it 4. This stripping happens after `rewriteRequestHeaders`, allowing clients to target proxy-added headers for removal RFC 7230 Section 6.1 Connection header processing is intended for proxies to strip hop-by-hop headers from incoming requests before adding their own headers. The current implementation reverses this order, processing the client's Connection header after the proxy has already modified the header set. The call chain: 1. `@fastify/reply-from/index.js` line 91: `headers = { ...req.headers }` — copies ALL client headers including `connection` 2. `index.js` line 151: `requestHeaders = rewriteRequestHeaders(this.request, headers)` — proxy adds custom headers (e.g., `x-forwarded-by`) 3. `index.js` line 180: `requestImpl({...headers: requestHeaders...})` — passes headers to transport 4. `request.js` line 191 (undici): `getConnectionHeaders(req.headers)` — reads Connection header FROM THE CLIENT 5. `request.js` lines 198-200: Strips headers listed in Connection — including proxy-added headers This is distinct from the general hop-by-hop forwarding concern — it's specifically about the client controlling which headers get stripped from the upstream request via the Connection header, subverting the proxy's `rewriteRequestHeaders` function. ### PoC Self-contained reproduction with an upstream echo service and a proxy that adds a custom header: ```javascript const fastify = require('fastify'); async function test() { // Upstream service that echoes headers const upstream = fastify({ logger: false }); upstream.get('/api/echo-headers', async (request) => { return { headers: request.headers }; }); await upstream.listen({ port: 19801 }); // Proxy that adds a custom header via rewriteRequestHeaders const proxy = fastify({ logger: false }); await proxy.register(require('@fastify/reply-from'), { base: 'http://localhost:19801' }); proxy.get('/proxy/*', async (request, reply) => { const target = '/' + (request.params['*'] || ''); return reply.from(target, { rewriteRequestHeaders: (originalReq, headers) => { return { ...headers, 'x-forwarded-by': 'fastify-proxy' }; } }); }); await proxy.listen({ port: 19800 }); // Baseline: proxy adds x-forwarded-by header const res1 = await proxy.inject({ method: 'GET', url: '/proxy/api/echo-headers' }); console.log('Baseline response headers from upstream:'); const body1 = JSON.parse(res1.body); console.log(' x-forwarded-by:', body1.headers['x-forwarded-by'] || 'NOT PRESENT'); // Attack: Connection header strips the proxy-added header const res2 = await proxy.inject({ method: 'GET', url: '/proxy/api/echo-headers', headers: { 'connection': 'x-forwarded-by' } }); console.log('\nAttack response headers from upstream:'); const body2 = JSON.parse(res2.body); console.log(' x-forwarded-by:', body2.headers['x-forwarded-by'] || 'NOT PRESENT (stripped!)'); await proxy.close(); await upstream.close(); } test(); ``` Actual output: ``` Baseline response headers from upstream: x-forwarded-by: fastify-proxy Attack response headers from upstream: x-forwarded-by: NOT PRESENT (stripped!) ``` The `x-forwarded-by` header that the proxy explicitly added in `rewriteRequestHeaders` is stripped before reaching the upstream. Multiple headers can be stripped at once by sending `Connection: x-forwarded-by, x-forwarded-for`. Both the undici (default) and HTTP/1.1 transport handlers in `@fastify/reply-from` are affected, as well as `@fastify/http-proxy` which delegates to `@fastify/reply-from`. ### Impact Attackers can selectively remove any header added by the proxy's `rewriteRequestHeaders` function. This enables several attack scenarios: 1. **Bypass proxy identification**: Strip headers that identify requests as coming through the proxy, potentially bypassing upstream controls that differentiate between direct and proxied requests 2. **Circumvent access control**: If the proxy adds headers used for routing, authorization, or security decisions (e.g., `x-internal-auth`, `x-proxy-token`), attackers can strip them to access unauthorized resources 3. **Remove arbitrary headers**: Any header can be targeted, including `Connection: authorization` to strip authentication or `Connection: x-forwarded-for, x-forwarded-by` to remove multiple headers at once This vulnerability affects deployments where the proxy adds security-relevant headers that downstream services rely on for access control decisions. It undermines the security model where proxies act as trusted intermediaries adding authentication or routing signals. ### Affected Versions - `@fastify/reply-from` — All versions, both undici (default) and HTTP/1.1 transport handlers - `@fastify/http-proxy` — All versions (delegates to `@fastify/reply-from`) - Any configuration using `rewriteRequestHeaders` to add headers that could be security-relevant - No special configuration required to exploit — works with default settings ### Suggested Fix The Connection header from the client should be processed and consumed before `rewriteRequestHeaders` is called, not after. Alternatively, the Connection header processing in `request.js` should maintain a list of headers that existed in the original client request and only strip those, not headers added by `rewriteRequestHeaders`.

CVE-2026-33805 Affected @fastify/reply from Versions

2 component(s)
Fixed Versions:
12.6.211.4.4
Product / Package Ecosystem Affected Versions Fixed Version
@fastify/reply-from
npm
< 12.6.2
12.6.2
@fastify/http-proxy
npm
< 11.4.4
11.4.4

References

Frequently Asked Questions

What is CVE-2026-33805?
CVE-2026-33805 is a security vulnerability in @fastify/reply from involving Fastify's connection header abuse enables stripping of proxy-added headers under CWE-644: Improper Neutralization of HTTP Headers for Scripting Syntax.
Which @fastify/reply from versions are affected?
Affected versions include releases prior to 12.6.2, 11.4.4 across affected packages: @fastify/reply-from, @fastify/http-proxy.
What version fixes CVE-2026-33805?
Upgrading to 12.6.2, 11.4.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @fastify/reply-from affected?
Yes, @fastify/reply-from is affected in releases prior to 12.6.2. Upgrade your dependency to 12.6.2 or later.
Is @fastify/http-proxy affected?
Yes, @fastify/http-proxy is affected in releases prior to 11.4.4. Upgrade your dependency to 11.4.4 or later.
What is the CVSS score of CVE-2026-33805?
CVE-2026-33805 has a CVSS v3.1 base score of 8.6 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N.
What CWE is associated with CVE-2026-33805?
CVE-2026-33805 is classified under CWE-644: Improper Neutralization of HTTP Headers for Scripting Syntax (The product does not neutralize or incorrectly neutralizes web scripting syntax in HTTP headers that can be used by web browser components that can process raw headers, such as Flash.).
How can I check npm dependencies for CVE-2026-33805?
Run the dependency tree command: 'npm ls @fastify/reply-from'. 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-gwhp-pf74-vj37",
  "modified" : "2026-06-09T10:48:00Z",
  "published" : "2026-04-16T01:02:59Z",
  "aliases" : [ "CVE-2026-33805" ],
  "summary" : "Fastify's connection header abuse enables stripping of proxy-added headers",
  "details" : "### Summary\n\n`@fastify/reply-from` and `@fastify/http-proxy` process the client's `Connection` header after the proxy has added its own headers via `rewriteRequestHeaders`. This allows attackers to retroactively strip proxy-added headers (like access control or identification headers) from upstream requests by listing them in the `Connection` header value. This affects applications using these plugins with custom header injection for routing, access control, or security purposes.\n\n### Details\n\nThe vulnerability exists in `@fastify/reply-from/lib/request.js` at lines 128-136 (HTTP/1.1 handler) and lines 191-200 (undici handler). The processing flow is:\n\n1. Client headers are copied including the `connection` header (`@fastify/reply-from/index.js` line 91)\n2. The proxy adds custom headers via `rewriteRequestHeaders` (line 151)\n3. During request construction, the transport handlers read the client's `Connection` header and strip any headers listed in it\n4. This stripping happens after `rewriteRequestHeaders`, allowing clients to target proxy-added headers for removal\n\nRFC 7230 Section 6.1 Connection header processing is intended for proxies to strip hop-by-hop headers from incoming requests before adding their own headers. The current implementation reverses this order, processing the client's Connection header after the proxy has already modified the header set.\n\nThe call chain:\n1. `@fastify/reply-from/index.js` line 91: `headers = { ...req.headers }` — copies ALL client headers including `connection`\n2. `index.js` line 151: `requestHeaders = rewriteRequestHeaders(this.request, headers)` — proxy adds custom headers (e.g., `x-forwarded-by`)\n3. `index.js` line 180: `requestImpl({...headers: requestHeaders...})` — passes headers to transport\n4. `request.js` line 191 (undici): `getConnectionHeaders(req.headers)` — reads Connection header FROM THE CLIENT\n5. `request.js` lines 198-200: Strips headers listed in Connection — including proxy-added headers\n\nThis is distinct from the general hop-by-hop forwarding concern — it's specifically about the client controlling which headers get stripped from the upstream request via the Connection header, subverting the proxy's `rewriteRequestHeaders` function.\n\n### PoC\n\nSelf-contained reproduction with an upstream echo service and a proxy that adds a custom header:\n\n```javascript\nconst fastify = require('fastify');\n\nasync function test() {\n  // Upstream service that echoes headers\n  const upstream = fastify({ logger: false });\n  upstream.get('/api/echo-headers', async (request) => {\n    return { headers: request.headers };\n  });\n  await upstream.listen({ port: 19801 });\n\n  // Proxy that adds a custom header via rewriteRequestHeaders\n  const proxy = fastify({ logger: false });\n  await proxy.register(require('@fastify/reply-from'), {\n    base: 'http://localhost:19801'\n  });\n\n  proxy.get('/proxy/*', async (request, reply) => {\n    const target = '/' + (request.params['*'] || '');\n    return reply.from(target, {\n      rewriteRequestHeaders: (originalReq, headers) => {\n        return { ...headers, 'x-forwarded-by': 'fastify-proxy' };\n      }\n    });\n  });\n\n  await proxy.listen({ port: 19800 });\n\n  // Baseline: proxy adds x-forwarded-by header\n  const res1 = await proxy.inject({\n    method: 'GET',\n    url: '/proxy/api/echo-headers'\n  });\n  console.log('Baseline response headers from upstream:');\n  const body1 = JSON.parse(res1.body);\n  console.log('  x-forwarded-by:', body1.headers['x-forwarded-by'] || 'NOT PRESENT');\n\n  // Attack: Connection header strips the proxy-added header\n  const res2 = await proxy.inject({\n    method: 'GET',\n    url: '/proxy/api/echo-headers',\n    headers: { 'connection': 'x-forwarded-by' }\n  });\n  console.log('\\nAttack response headers from upstream:');\n  const body2 = JSON.parse(res2.body);\n  console.log('  x-forwarded-by:', body2.headers['x-forwarded-by'] || 'NOT PRESENT (stripped!)');\n\n  await proxy.close();\n  await upstream.close();\n}\ntest();\n```\n\nActual output:\n```\nBaseline response headers from upstream:\n  x-forwarded-by: fastify-proxy\n\nAttack response headers from upstream:\n  x-forwarded-by: NOT PRESENT (stripped!)\n```\n\nThe `x-forwarded-by` header that the proxy explicitly added in `rewriteRequestHeaders` is stripped before reaching the upstream.\n\nMultiple headers can be stripped at once by sending `Connection: x-forwarded-by, x-forwarded-for`.\n\nBoth the undici (default) and HTTP/1.1 transport handlers in `@fastify/reply-from` are affected, as well as `@fastify/http-proxy` which delegates to `@fastify/reply-from`.\n\n### Impact\n\nAttackers can selectively remove any header added by the proxy's `rewriteRequestHeaders` function. This enables several attack scenarios:\n\n1. **Bypass proxy identification**: Strip headers that identify requests as coming through the proxy, potentially bypassing upstream controls that differentiate between direct and proxied requests\n2. **Circumvent access control**: If the proxy adds headers used for routing, authorization, or security decisions (e.g., `x-internal-auth`, `x-proxy-token`), attackers can strip them to access unauthorized resources\n3. **Remove arbitrary headers**: Any header can be targeted, including `Connection: authorization` to strip authentication or `Connection: x-forwarded-for, x-forwarded-by` to remove multiple headers at once\n\nThis vulnerability affects deployments where the proxy adds security-relevant headers that downstream services rely on for access control decisions. It undermines the security model where proxies act as trusted intermediaries adding authentication or routing signals.\n\n### Affected Versions\n\n- `@fastify/reply-from` — All versions, both undici (default) and HTTP/1.1 transport handlers\n- `@fastify/http-proxy` — All versions (delegates to `@fastify/reply-from`)\n- Any configuration using `rewriteRequestHeaders` to add headers that could be security-relevant\n- No special configuration required to exploit — works with default settings\n\n### Suggested Fix\n\nThe Connection header from the client should be processed and consumed before `rewriteRequestHeaders` is called, not after. Alternatively, the Connection header processing in `request.js` should maintain a list of headers that existed in the original client request and only strip those, not headers added by `rewriteRequestHeaders`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:N/SC:L/SI:H/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@fastify/reply-from"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "12.6.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 12.6.1"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@fastify/http-proxy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "11.4.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 11.4.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/fastify/fastify-reply-from/security/advisories/GHSA-gwhp-pf74-vj37"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33805"
  }, {
    "type" : "WEB",
    "url" : "https://cna.openjsf.org/security-advisories.html"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/fastify/fastify-reply-from"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-644" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-16T01:02:59Z",
    "nvd_published_at" : "2026-04-15T11:16:34Z"
  }
}