GitHub Advisoryadvisory · Go

GHSA-82ff-hg59-8x73 github.com/gorilla/csrf improperly validates TrustedOrigins allowing CSRF attacks

MEDIUM Published 2025-08-29 Modified 2025-08-29 Official page ↗
Aliases
CVE-2025-47909
Ecosystem
Go
Packages
github.com/gorilla/csrf
Severity
Moderate
CVSS vector
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
Weaknesses
CWE-352, CWE-807
Reviewed
2025-08-29

Affected packages

• Go github.com/gorilla/csrf: <= 1.7.3 (no fix yet)

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.

Related

Alias · CVE (1)

  • CVE-2025-47909 Hosts listed in TrustedOrigins implicitly allow requests from the corresponding HTTP origins, allowing network MitMs to perform CSRF… vulnerability

Weakness · CWE (2)

  • CWE-352 Cross-Site Request Forgery weakness
  • CWE-807 Reliance on Untrusted Inputs in a Security Decision weakness

References