You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The new library uses modern browser headers (Sec-Fetch-Site, Origin) instead of tokens, simplifying the codebase by removing all CSRF token handling from templates and JavaScript.
How filippo.io/csrf handles older browsers:
Modern browsers (2023+): Sec-Fetch-Site header - explicitly says "same-origin" vs "cross-site"
Older browsers (2012-2023): Falls back to Origin header comparison (supported since Chrome 4, Firefox 4, Safari 5, IE 10)
Very old browsers (no headers): Requests are BLOCKED, not allowed through
Reacted by Steven Hartland and Christophe Colombier
Activity
shortontech commentedon Nov 9, 2025
According to the GitHub advisory, this issue is fixed in tagged release v1.7.3
gorilla/csrf CSRF vulnerability due to broken Referer validation
It's also in the changelog for the tag here
stevenh commentedon Dec 17, 2025
I don't believe thats the case:
Affected versions:
<= 1.7.3stevenh commentedon Dec 17, 2025
Also still flagged on pkg.go.dev
GO-2025-3884: Improper validation of TrustedOrigins allows CSRF attacks in github.com/gorilla/csrf
hazcod commentedon Dec 31, 2025
Can we update the github advisory then to not have v1.7.3 affected?
stevenh commentedon Jan 4, 2026
Have you proved its not effected?
hazcod commentedon Jan 4, 2026
https://github.com/gorilla/csrf/releases/tag/v1.7.3 ?
stevenh commentedon Jan 5, 2026
That's a different CVE: CVE-2025-24358
rayjanoka commentedon Jan 26, 2026
replacement at https://github.com/FiloSottile/csrf
How filippo.io/csrf handles older browsers: