{"id":"GHSA-3m5p-2c4r-xxw2","revision":"c47ae64d776746acbfaac110c51e4dfb","records":[{"revision":"c47ae64d776746acbfaac110c51e4dfb","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-3m5p-2c4r-xxw2","aliases":["CVE-2026-16732"],"title":"fastify vulnerable to X-Forwarded-* spoofing under trustProxy hop-count","description":"## Impact\n\nThe fix for [CVE-2026-3635](https://www.cve.org/CVERecord?id=CVE-2026-3635) ([GHSA-444r-cwp2-x5xf](https://github.com/fastify/fastify/security/advisories/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`.\n\nApplications 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.\n\n## Patches\n\nPatched in fastify 5.12.1. The numeric form of `trustProxy` is now disabled at runtime and removed from the TypeScript type union.\n\n## Workarounds\n\n- Migrate to an IP / CIDR / custom-function `trustProxy` value that validates the connecting address. Custom functions must inspect the `address` argument, not only the hop index.\n- Ensure the Fastify origin is only reachable through the trusted proxy chain (no direct network path).","state":0,"publishedAt":"2026-09-02T15:14:06+00:00","modifiedAt":"2026-09-02T15:30:17.6273426+00:00","affected":[{"ecosystem":"npm","name":"fastify","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"5.8.3"},{"kind":"fixed","version":"5.12.1"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"MODERATE"}],"references":["https://github.com/fastify/fastify/security/advisories/GHSA-3m5p-2c4r-xxw2","https://nvd.nist.gov/vuln/detail/CVE-2026-16732","https://github.com/fastify/fastify/commit/8acfea7eada05383a7357e3eb21c2628416df280","https://cna.openjsf.org/security-advisories.html","https://github.com/fastify/fastify","https://github.com/fastify/fastify/releases/tag/v5.12.1"],"sourceUrl":"https://github.com/advisories/GHSA-3m5p-2c4r-xxw2","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-3m5p-2c4r-xxw2","identifiers":["GHSA-3m5p-2c4r-xxw2","CVE-2026-16732"]},"retained":false,"historicalAffected":[]}],"coverage":[]}