{"id":"CVE-2026-3635","aliases":["CVE-2026-3635","GHSA-444r-cwp2-x5xf"],"related":[],"kind":"vulnerability","state":"published","title":"Fastify request.protocol and request.host spoofable via X-Forwarded-Proto/Host from untrusted connections when trustProxy uses restrictive trust function","summary":"Summary\nWhen 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.\n\nAffected Versions\nfastify <= 5.8.2\n\nImpact\nApplications 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.\n\nWhen trustProxy: true (trust everything), both host and protocol trust all forwarded headers — this is expected behavior. The vulnerability only manifests with restrictive trust configurations.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Summary\nWhen 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.\n\nAffected Versions\nfastify <= 5.8.2\n\nImpact\nApplications 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.\n\nWhen trustProxy: true (trust everything), both host and protocol trust all forwarded headers — this is expected behavior. The vulnerability only manifests with restrictive trust configurations.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nWhen `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.\n\n## Affected Versions\n\nfastify <= 5.8.2\n\n## Impact\n\nApplications 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.\n\nWhen `trustProxy: true` (trust everything), both `host` and `protocol` trust all forwarded headers — this is expected behavior. The vulnerability only manifests with restrictive trust configurations.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Resumen\nCuando `trustProxy` se configura con una función de confianza restrictiva (por ejemplo, una IP específica como `trustProxy: '10.0.0.1'`, una subred, un recuento de saltos o una función personalizada), los *getters* `request.protocol` y `request.host` leen los encabezados `X-Forwarded-Proto` y `X-Forwarded-Host` de cualquier conexión, incluidas las conexiones de IPs no confiables. Esto permite a un atacante que se conecta directamente a Fastify (saltándose el proxy) suplantar tanto el protocolo como el *host* vistos por la aplicación.\n\nVersiones Afectadas\nfastify &lt;= 5.8.2\n\nImpacto\nLas aplicaciones que utilizan `request.protocol` o `request.host` para decisiones de seguridad (aplicación de HTTPS, *flags* de cookie seguras, comprobaciones de origen CSRF, construcción de URL, enrutamiento basado en *host*) se ven afectadas cuando `trustProxy` se configura con una función de confianza restrictiva.\n\nCuando `trustProxy: true` (confiar en todo), tanto el *host* como el protocolo confían en todos los encabezados reenviados — este es el comportamiento esperado. La vulnerabilidad solo se manifiesta con configuraciones de confianza restrictivas.","source":"nvd"}],"published":"2026-03-23T13:53:00.386Z","modified":"2026-06-17T10:43:54.143Z","severity":{"scorer":"openjs","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"openjs","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-348"],"affected":[{"ranges":[{"type":"semver","introduced":"0","lastAffected":"5.8.2","status":"affected"},{"type":"semver","version":"5.8.3","status":"unaffected"}],"vendor":"fastify","product":"fastify","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.8.3"}],"ecosystem":"npm","package":"fastify","purl":"pkg:npm/fastify","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"5.8.3"}],"vendor":"fastify","product":"fastify","cpe":"cpe:2.3:a:fastify:fastify:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/fastify/fastify/security/advisories/GHSA-444r-cwp2-x5xf","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-3635","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://cna.openjsf.org/security-advisories.html","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-3635","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/fastify/fastify","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/fastify/fastify/releases/tag/v5.8.3","tags":["web"],"sources":["ghsa"]}],"credits":["LetaoZhao (TinkAnet)","KaKa (climba03003)","Matteo Collina","Ulises Gascón"],"assigner":"openjs","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-03-23T15:29:15.532Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-3635","url":"https://www.cve.org/CVERecord?id=CVE-2026-3635","licence":"CVE Terms of Use","modified":"2026-03-23T15:30:10.526Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-444r-cwp2-x5xf","url":"https://github.com/advisories/GHSA-444r-cwp2-x5xf","licence":"CC-BY-4.0","modified":"2026-03-25T19:56:21.108Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-3635","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-3635","licence":"Public domain","modified":"2026-06-17T10:43:54.143Z"}],"updatedAt":"2026-11-25T22:59:16.459Z","epss":{"score":0.00167,"percentile":0.06236,"date":"2026-12-02T12:00:21.000Z"}}