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

Medium 5.4 Published Updated

An attacker with XSS on a related domain can bypass CSRF protections to perform authenticated actions on Go web applications using this library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2025-24358?

CVE-2025-24358 is a medium-severity vulnerability in gorilla csrf, published on 15 Apr 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

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.

Weakness: CWE-352

Which versions are affected by CVE-2025-24358?

3 open source packages ship an affected version, including github.com/gorilla/csrf.

PackageAffectedFixed in
github.com/gorilla/csrf GoAll versions1.7.3
github.com/gorilla/csrf GoAll versions1.7.3
github.com/gorilla/csrf GoAll versions1.7.3

How do I fix CVE-2025-24358?

Upgrade github.com/gorilla/csrf to 1.7.3 or later.

Is CVE-2025-24358 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-24358 exists.

Sources

Also known as CLEANSTART-2025-TT45966, DEBIAN-CVE-2025-24358, DLA-4151-1, GHSA-rq77-p4h8-4crw, GO-2025-3607, MINI-447g-8ffj-q7jp and 8 more.

Is CVE-2025-24358 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free