GHSA-444r-cwp2-x5xf CVE-2026-3635
fastify: request.protocol and request.host Spoofable via X-Forwarded-Proto/Host from Untrusted Connections
- Severity
- 6.1 / 10
- Medium · CVSS 3.1
- Exploit chance (EPSS)
- 0.16%
- Chance of exploitation in the next 30 days. Higher than 5.31% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-348 Use of Less Trusted Source
- Fix
5.8.3- Upgrade fastify to this version or later
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.
Affected versions
npm
| Package | Vulnerable | Fixed in |
|---|---|---|
| fastify | < 5.8.3 |
5.8.3 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
fastify npm → 5.8.3
- npm
npm install fastify@5.8.3- yarn
yarn add fastify@5.8.3- pnpm
pnpm add fastify@5.8.3
Severity breakdown
CVSS 3.1 6.1
CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N
- Attack vector
- Adjacent
- Attack complexity
- High
- Privileges required
- None
- User interaction
- None
- Scope
- Changed
- Confidentiality
- High
- Integrity
- None
- Availability
- None
Weakness
CWE-348: Use of Less Trusted Source
The product has two different sources of the same data or information, but it uses the source that has less support for verification, is less trusted, or is less resistant to attack.
References
Advisories
Packages
Other links
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-389g-gv7q-r4x8 fastify is vulnerable to header validation bypass via case-sensitive propertyNames | Low | Also affects fastify |
| GHSA-4mh8-r7rc-xpvc fastify vulnerable to Denial of Service via unhandled exception on HTTP/2 trailer responses | Medium | Also affects fastify |
| GHSA-9q9j-q6p8-xq58 fastify vulnerable to header validation bypass via incomplete schema case normalization | High | Also affects fastify |
| GHSA-667r-xxjv-c9mm fastify vulnerable to request body replacement via an async validation result collision | High | Also affects fastify |
| GHSA-hwr6-493r-vm6h fastify vulnerable to request validation bypass via skipped boolean false schemas | High | Also affects fastify |
| GHSA-p68q-wchp-6fh7 fastify vulnerable to authentication bypass via malformed URLs reaching encapsulated not-found handlers | High | Also affects fastify |
| GHSA-w2qp-rph6-63g4 fastify vulnerable to schema validation bypass via root primitive coercion mismatch | Medium | Also affects fastify |
| GHSA-3m5p-2c4r-xxw2 fastify vulnerable to X-Forwarded-* spoofing under trustProxy hop-count | Medium | Also affects fastify |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor