Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/gorilla/csrf
  4. ›
  5. CVE-2025-47909

CVE-2025-47909: github.com/gorilla/csrf improperly validates TrustedOrigins allowing CSRF attacks

August 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

  • github.com/advisories/GHSA-82ff-hg59-8x73
  • github.com/golang/vulndb/issues/3884
  • github.com/gorilla/csrf
  • nvd.nist.gov/vuln/detail/CVE-2025-47909
  • pkg.go.dev/vuln/GO-2025-3884

Code Behaviors & Features

Detect and mitigate CVE-2025-47909 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions up to 1.7.3

Solution

Unfortunately, there is no solution available yet.

Weakness

  • CWE-352: Cross-Site Request Forgery (CSRF)
  • CWE-807: Reliance on Untrusted Inputs in a Security Decision

Source file

go/github.com/gorilla/csrf/CVE-2025-47909.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 30 Aug 2025 00:18:38 +0000.