Every CVE Search/ Get API key

CVE-2025-24358

gorilla/csrf CSRF vulnerability due to broken Referer validation

5.4 MediumFix available

gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services. Prior to 1.7.2, gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice. This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain. This vulnerability is fixed in 1.7.2.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
Passive

What an attacker can affect

Confidentiality
None
Integrity
High
Availability
None

Exploit likelihood

0.37%Up 0.4 points since Apr 16, 2025
90%50%10%1%

What each source reports

CVE List Score used 5.4

gorilla/csrf CSRF vulnerability due to broken Referer validation

gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services. Prior to 1.7.2, gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice. This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain. This vulnerability is fixed in 1.7.2.

Record
CVE-2025-24358
CVSS 4.0
5.4 MediumCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P
Weakness
CWE-352
Updated
2026-11-02
EUVDEUVD-2025-10883 5.4

gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services. Prior to 1.7.2, gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice. This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain. This vulnerability is fixed in 1.7.2.

Record
EUVD-2025-10883
CVSS 4.0
5.4 MediumCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P
Updated
2026-11-02
GitHub AdvisoriesGHSA-rq77-p4h8-4crw 5.4

gorilla/csrf CSRF vulnerability due to broken Referer validation

Summary

gorilla/csrf is vulnerable to CSRF via form submission from origins that share a top level domain with the target origin.

Details

gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice.

	// URL specifies either the URI being requested (for server
	// requests) or the URL to access (for client requests).
	//
	// For server requests, the URL is parsed from the URI
	// supplied on the Request-Line as stored in RequestURI.  For
	// most requests, fields other than Path and RawQuery will be
	// empty. (See [RFC 7230, Section 5.3](https://rfc-editor.org/rfc/rfc7230.html#section-5.3))
	//
	// For client requests, the URL's Host specifies the server to
	// connect to, while the Request's Host field optionally
	// specifies the Host header value to send in the HTTP
	// request.
	URL *[url](https://pkg.go.dev/net/url).[URL](https://pkg.go.dev/net/url#URL)

PoC

  • create trusted origin target.example.test protected with gorilla/csrf and served over TLS hosting form on /submit
  • create attacker origin attack.example.test served over TLS
  • attacker exfiltrates token & cookie combination from target.example.test
  • attacker sets exfiltrated cookie with domain=.example.test and path=/submit
    • as the cookie has a more specific path than / (the default for CSRF cookies) it will be sent first by the browser on submit to our target origin
  • submit form from attack.example.test with exfiltrated CSRF form token
  • observe valid form submission as attack.example.test Origin / Referer headers are not validated.

Impact

This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain.

This bug has existed in gorilla/csrf since its initial release in 2015.

Record
GHSA-rq77-p4h8-4crw
CVSS 4.0
5.4 MediumCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P
Weakness
CWE-352
Updated
2026-11-02
NVD 5.4

gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services. Prior to 1.7.2, gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice. This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain. This vulnerability is fixed in 1.7.2.

Record
CVE-2025-24358
CVSS 4.0
5.4 MediumCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Weakness
CWE-352
Updated
2026-11-02
OSV 5.4

gorilla/csrf CSRF vulnerability due to broken Referer validation

gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services. Prior to 1.7.2, gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice. This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain. This vulnerability is fixed in 1.7.2.

Record
CVE-2025-24358
CVSS 4.0
5.4 MediumCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P
Weakness
CWE-352
Updated
2026-11-02
OSVDEBIAN-CVE-2025-24358 5.4

gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services. Prior to 1.7.2, gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice. This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain. This vulnerability is fixed in 1.7.2.

Record
DEBIAN-CVE-2025-24358
CVSS 4.0
5.4 MediumCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Updated
2026-11-02
Show 5 moreShow less
OSVGHSA-rq77-p4h8-4crw 5.4

gorilla/csrf CSRF vulnerability due to broken Referer validation

Summary

gorilla/csrf is vulnerable to CSRF via form submission from origins that share a top level domain with the target origin.

Details

gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice.

	// URL specifies either the URI being requested (for server
	// requests) or the URL to access (for client requests).
	//
	// For server requests, the URL is parsed from the URI
	// supplied on the Request-Line as stored in RequestURI.  For
	// most requests, fields other than Path and RawQuery will be
	// empty. (See [RFC 7230, Section 5.3](https://rfc-editor.org/rfc/rfc7230.html#section-5.3))
	//
	// For client requests, the URL's Host specifies the server to
	// connect to, while the Request's Host field optionally
	// specifies the Host header value to send in the HTTP
	// request.
	URL *[url](https://pkg.go.dev/net/url).[URL](https://pkg.go.dev/net/url#URL)

PoC

  • create trusted origin target.example.test protected with gorilla/csrf and served over TLS hosting form on /submit
  • create attacker origin attack.example.test served over TLS
  • attacker exfiltrates token & cookie combination from target.example.test
  • attacker sets exfiltrated cookie with domain=.example.test and path=/submit
    • as the cookie has a more specific path than / (the default for CSRF cookies) it will be sent first by the browser on submit to our target origin
  • submit form from attack.example.test with exfiltrated CSRF form token
  • observe valid form submission as attack.example.test Origin / Referer headers are not validated.

Impact

This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain.

This bug has existed in gorilla/csrf since its initial release in 2015.

Record
GHSA-rq77-p4h8-4crw
CVSS 4.0
5.4 MediumCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P
Weakness
CWE-352
Updated
2026-11-02
OSVUBUNTU-CVE-2025-24358 5.4

gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services. Prior to 1.7.2, gorilla/csrf does not validate the Origin header against an allowlist. Its executes its validation of the Referer header for cross-origin requests only when it believes the request is being served over TLS. It determines this by inspecting the r.URL.Scheme value. However, this value is never populated for "server" requests per the Go spec, and so this check does not run in practice. This vulnerability allows an attacker who has gained XSS on a subdomain or top level domain to perform authenticated form submissions against gorilla/csrf protected targets that share the same top level domain. This vulnerability is fixed in 1.7.2.

Record
UBUNTU-CVE-2025-24358
CVSS 4.0
5.4 MediumCVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:P
Updated
2026-11-02
OSVGO-2025-3607 No score

gorilla/csrf CSRF vulnerability due to broken Referer validation in github.com/gorilla/csrf

gorilla/csrf CSRF vulnerability due to broken Referer validation in github.com/gorilla/csrf

Record
GO-2025-3607
Updated
2026-11-02
OSVopenSUSE-SU-2025:15017-1 No score

govulncheck-vulndb-0.0.20250422T181640-1.1 on GA media

These are all security issues fixed in the govulncheck-vulndb-0.0.20250422T181640-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2025:15017-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:11126-1 No score

velociraptor-0.7.0.4.git185.a5708584-2.1 on GA media

These are all security issues fixed in the velociraptor-0.7.0.4.git185.a5708584-2.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:11126-1
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
github.com/gorilla/csrf
Go
before 1.7.3
1.7.3
golang-github-gorilla-csrf
Debian:12
All versions, plus listed versions
1.7.1-11.7.2+ds1-11.7.2+ds1-21.7.2+ds1-31.7.2-11.7.2-1~bpo12+1
None known
golang-github-gorilla-csrf
Debian:13
before 1.7.2+ds1-2
1.7.2+ds1-2
golang-github-gorilla-csrf
Debian:14
before 1.7.2+ds1-2
1.7.2+ds1-2
golang-github-gorilla-csrf
Debian:11
before 1.6.2-2+deb11u1, plus listed versions
1.6.2-2
1.6.2-2+deb11u1
golang-github-gorilla-csrf
Ubuntu:20.04:LTS
All versions, plus listed versions
1.6.2-11.6.2-2
None known
golang-github-gorilla-csrf
Ubuntu:22.04:LTS
All versions, plus listed versions
1.6.2-2
None known
golang-github-gorilla-csrf
Ubuntu:24.04:LTS
All versions, plus listed versions
1.7.1-11.7.2-1
None known
golang-github-gorilla-csrf
Ubuntu:25.10
All versions, plus listed versions
1.7.2+ds1-11.7.2+ds1-2
None known
golang-github-gorilla-csrf
Ubuntu:26.10
All versions, plus listed versions
1.7.2+ds1-21.7.2+ds1-3
None known
golang-github-gorilla-csrf
Ubuntu:26.04:LTS
All versions, plus listed versions
1.7.2+ds1-2
None known
govulncheck-vulndb
openSUSE:Tumbleweed
From an advisory covering 23 CVEs
before 0.0.20250422T181640-1.1
0.0.20250422T181640-1.1
velociraptor
openSUSE:Tumbleweed
From an advisory covering 49 CVEs
before 0.7.0.4.git185.a5708584-2.1
0.7.0.4.git185.a5708584-2.1

History

History
RecordedChangedSources
affected, facts
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2025-24358 is a medium vulnerability (CVSS 5.4) in Gorilla Csrf, published April 14, 2025. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.37%, the 31st percentile. Fixed in github.com/gorilla/csrf 1.7.3.

References

Show 77 moreShow less
MoveEnter Open