7.3high
Improper validation of TrustedOrigins allows CSRF attacks in github.com/gorilla/csrf
- Severity
- 7.3high CVSS:3.1 by CISA-ADP
- Exploit likelihood
- 0.19% (higher than 8% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Go
- Also known as
- GHSA-82ff-hg59-8x73GO-2025-3884
Description
Hosts listed in TrustedOrigins implicitly allow requests from the corresponding HTTP origins, allowing network MitMs to perform CSRF attacks. After the CVE-2025-24358 fix, a network attacker that places a form at http://example.com can't get it to submit to https://example.com because the Origin header is checked with sameOrigin against a synthetic URL. However, if a host is added to TrustedOrigins, both its HTTP and HTTPS origins will be allowed, because the schema of the synthetic URL is ignored and only the host is checked. For example, if an application is hosted on https://example.com and adds example.net to TrustedOrigins, a network attacker can serve a form at http://example.net to perform the attack. Applications should migrate to net/http.CrossOriginProtection, introduced in Go 1.25. If that is not an option, a backport is available as a module at filippo.io/csrf, and a drop-in replacement for the github.com/gorilla/csrf API is available at filippo.io/csrf/gorilla.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| github.com/gorilla/csrf | Not specified Not affected: before 1.7.3 | CVE List |
| github.com/gorilla/csrf (Go) | up to 1.7.3, from 1.7.3 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| CISA-ADP | 7.3high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:A/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:U |
Classification
What each source says
CVE List
Hosts listed in TrustedOrigins implicitly allow requests from the corresponding HTTP origins, allowing network MitMs to perform CSRF attacks. After the CVE-2025-24358 fix, a network attacker that places a form at http://example.com can't get it to submit to https://example.com because the Origin header is checked with sameOrigin against a synthetic URL. However, if a host is added to TrustedOrigins, both its HTTP and HTTPS origins will be allowed, because the schema of the synthetic URL is ignored and only the host is checked. For example, if an application is hosted on https://example.com and adds example.net to TrustedOrigins, a network attacker can serve a form at http://example.net to perform the attack. Applications should migrate to net/http.CrossOriginProtection, introduced in Go 1.25. If that is not an option, a backport is available as a module at filippo.io/csrf, and a drop-in replacement for the github.com/gorilla/csrf API is available at filippo.io/csrf/gorilla.
NVD (es)
Los hosts listados en TrustedOrigins permiten implícitamente solicitudes de los orígenes HTTP correspondientes, permitiendo a los MitM de red realizar ataques CSRF. Después de la corrección de CVE-2025-24358, un atacante de red que coloca un formulario en http://example.com no puede lograr que se envíe a https://example.com porque el encabezado Origin se verifica con sameOrigin contra una URL sintética. Sin embargo, si se añade un host a TrustedOrigins, se permitirán tanto sus orígenes HTTP como HTTPS, porque el esquema de la URL sintética se ignora y solo se verifica el host. Por ejemplo, si una aplicación está alojada en https://example.com y añade example.net a TrustedOrigins, un atacante de red puede servir un formulario en http://example.net para realizar el ataque. Las aplicaciones deberían migrar a net/http.CrossOriginProtection, introducido en Go 1.25. Si esa no es una opción, un backport está disponible como módulo en filippo.io/csrf, y un reemplazo directo para la API de github.com/gorilla/csrf está disponible en filippo.io/csrf/gorilla.
References
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-47909 changed 2025-08-29 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-82ff-hg59-8x73 changed 2026-09-10 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2025-3884 changed 2026-02-04 | CC-BY-4.0 |
| NVD | CVE-2025-47909 changed 2026-10-19 | Public domain |