github.com/gorilla/csrf improperly validates TrustedOrigins allowing CSRF attacks
Moderate severity
GitHub Reviewed
Published
Aug 29, 2025
to the GitHub Advisory Database
•
Updated Aug 29, 2025
Description
Published by the National Vulnerability Database
Aug 29, 2025
Published to the GitHub Advisory Database
Aug 29, 2025
Reviewed
Aug 29, 2025
Last updated
Aug 29, 2025
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.
References