Reliance on Untrusted Inputs in a Security Decision Affecting fastify package, versions >=5.8.3 <5.12.1


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.14% (5th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-FASTIFY-18965771
  • published19 Aug 2026
  • disclosed18 Aug 2026
  • creditalimony

Introduced: 18 Aug 2026

NewCVE-2026-16732  (opens in a new tab)
CWE-348  (opens in a new tab)
CWE-807  (opens in a new tab)

How to fix?

Upgrade fastify to version 5.12.1 or higher.

Overview

fastify is an overhead web framework, for Node.js.

Affected versions of this package are vulnerable to Reliance on Untrusted Inputs in a Security Decision through the getTrustProxyFn hop-count handling in lib/request.js when trustProxy is configured as a number. An attacker can overwrite request.ip, request.ips, request.host, request.hostname, and request.protocol by sending forged forwarded headers to an origin that is reachable directly, bypassing the front-facing proxy. This lets the attacker make the application treat an arbitrary client address and host as trusted, which can break host-based routing, generate poisoned absolute URLs, bypass HTTPS and secure-cookie checks, and skew cache or CSRF-origin decisions.

Workarounds

  • Migrate to an IP/CIDR string, IP/CIDR array, or custom-function trustProxy value that validates the connecting address; custom functions should inspect the address argument, not only the hop index. This prevents direct clients from spoofing X-Forwarded-* values through numeric hop-count trust.
  • Ensure the Fastify origin is only reachable through the trusted proxy chain, with no direct network path to the origin. This blocks attackers from bypassing the front-facing proxy and supplying forged forwarded headers.

CVSS Base Scores

version 4.0
version 3.1