Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. fastify
  4. ›
  5. CVE-2026-16732

CVE-2026-16732: fastify vulnerable to X-Forwarded-* spoofing under trustProxy hop-count

September 2, 2026

The fix for CVE-2026-3635 (GHSA-444r-cwp2-x5xf) added a proxyFn(socket.remoteAddress, 0) guard on the X-Forwarded-* reads in request.host, request.protocol, request.hostname, request.ip, and request.ips. That guard closes the IP, CIDR, and custom-function forms of trustProxy correctly because those forms compile to predicates that inspect the connecting address. The hop-count form (trustProxy: <number>) compiles to a predicate that structurally ignores the address argument, so the guard reduces to 0 < tp, always true for any tp >= 1.

Applications configured with trustProxy: <number> (documented as “behind N reverse proxies”, trustProxy: 1 being the canonical single-proxy setting) remain vulnerable. An attacker who can reach the Fastify origin directly, bypassing the front-facing proxy, can spoof the request fields exactly as in the unpatched version. Impact class matches the parent CVE-2026-3635: host injection in generated URLs, HTTPS-enforcement bypass, secure-cookie / CSRF-origin bypass, host-based routing and cache poisoning.

References

  • cna.openjsf.org/security-advisories.html
  • github.com/advisories/GHSA-3m5p-2c4r-xxw2
  • github.com/fastify/fastify/commit/8acfea7eada05383a7357e3eb21c2628416df280
  • github.com/fastify/fastify/releases/tag/v5.12.1
  • github.com/fastify/fastify/security/advisories/GHSA-3m5p-2c4r-xxw2
  • nvd.nist.gov/vuln/detail/CVE-2026-16732

Code Behaviors & Features

Detect and mitigate CVE-2026-16732 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 5.8.3 before 5.12.1

Fixed versions

  • 5.12.1

Solution

Upgrade to version 5.12.1 or above.

Impact 6.1 MEDIUM

CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N

Learn more about CVSS

Weakness

  • CWE-348: Use of Less Trusted Source

Source file

npm/fastify/CVE-2026-16732.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Thu, 10 Sep 2026 00:20:18 +0000.