Vulnerability · Published Apr 15, 2025 · Assigned by GitHub_M

CVE-2025-24358gorilla/csrf CSRF vulnerability due to broken Referer validation

Medium 5.4

In plain English

A medium-severity cross-site request forgery in csrf from gorilla. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.4% (higher than 32% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 4.0)5.4Medium
Exploit odds (30 days)0.4%top 68.5% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

Official description

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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12golang-github-gorilla-csrfno fix listedDEBIAN-CVE-2025-24358
Debian:13golang-github-gorilla-csrf1.7.2+ds1-2DEBIAN-CVE-2025-24358
Debian:14golang-github-gorilla-csrf1.7.2+ds1-2DEBIAN-CVE-2025-24358
Gogithub.com/gorilla/csrf1.7.3GO-2025-3607
Gogithub.com/gorilla/csrf1.7.3GHSA-rq77-p4h8-4crw
Ubuntu:22.04:LTSgolang-github-gorilla-csrfno fix listedUBUNTU-CVE-2025-24358
Ubuntu:24.04:LTSgolang-github-gorilla-csrfno fix listedUBUNTU-CVE-2025-24358
Ubuntu:25.10golang-github-gorilla-csrfno fix listedUBUNTU-CVE-2025-24358
Ubuntu:26.04:LTSgolang-github-gorilla-csrfno fix listedUBUNTU-CVE-2025-24358
Ubuntu:26.10golang-github-gorilla-csrfno fix listedUBUNTU-CVE-2025-24358

Affected products (as reported)

VendorProductVersions
gorilla csrf < 1.7.3

Weakness: CWE-352 · Vector: CVSS: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

References