Vulnerabilities in pkg:golang/github.com/gorilla/csrf

PACKAGE
Advisory Identifier: GHSA-82ff-hg59-8x73
Advisory Summary

CVE-2025-47909 is a MODERATE github.com/gorilla/csrf improperly validates trustedorigins allowing vulnerability (CWE-807: Reliance on Untrusted Inputs in a Security Decision) affecting Github.com/gorilla/csrf libraries in the Go ecosystem. The issue involves github.com/gorilla/csrf improperly validates trustedorigins allowing csrf attacks. Remediation is available in the latest vendor maintenance releases.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/gorilla/csrf

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/gorilla/csrf. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-82ff-hg59-8x73 CVE-2025-47909 MODERATE github.com/gorilla/csrf improperly validates TrustedOrigins allowing CSRF attacks
GHSA-rq77-p4h8-4crw CVE-2025-24358 MODERATE gorilla/csrf CSRF vulnerability due to broken Referer validation

CVE-2025-47909 at a Glance

CVE Identifier CVE-2025-47909
GHSA Identifier GHSA-82ff-hg59-8x73
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-807: Reliance on Untrusted Inputs in a Security Decision
Affected Product Github.com/gorilla/csrf
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2025-47909

To remediate this vulnerability, upgrade all affected Github.com/gorilla/csrf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/gorilla/csrf fixed: Latest secure release
Upgrade github.com/gorilla/csrf to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/gorilla/csrf

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-47909, inspect your project dependencies for Github.com/gorilla/csrf:

inspect dependencies for github.com/gorilla/csrf

Analyze the terminal output to locate any version of Github.com/gorilla/csrf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-807: Reliance on Untrusted Inputs in a Security Decision, where the product uses a protection mechanism that relies on the existence or values of an input, but the input can be modified by an untrusted actor in a way that bypasses the protection mechanism. In Github.com/gorilla/csrf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2025-47909 Affected Github.com/gorilla/csrf Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gorilla/csrf
Go
≤ 1.7.3

References

Frequently Asked Questions

What is CVE-2025-47909?
CVE-2025-47909 is a security vulnerability in Github.com/gorilla/csrf involving github.com/gorilla/csrf improperly validates TrustedOrigins allowing CSRF attacks under CWE-807: Reliance on Untrusted Inputs in a Security Decision.
Which Github.com/gorilla/csrf versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/gorilla/csrf.
What version fixes CVE-2025-47909?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gorilla/csrf affected?
Yes, github.com/gorilla/csrf is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What CWE is associated with CVE-2025-47909?
CVE-2025-47909 is classified under CWE-807: Reliance on Untrusted Inputs in a Security Decision (The product uses a protection mechanism that relies on the existence or values of an input, but the input can be modified by an untrusted actor in a way that bypasses the protection mechanism.).
How can I check Go dependencies for CVE-2025-47909?
Run the dependency tree command: 'inspect dependencies for github.com/gorilla/csrf'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-82ff-hg59-8x73",
  "modified" : "2025-08-29T20:23:17Z",
  "published" : "2025-08-29T20:23:16Z",
  "aliases" : [ "CVE-2025-47909" ],
  "summary" : "github.com/gorilla/csrf improperly validates TrustedOrigins allowing CSRF attacks",
  "details" : "Hosts listed in TrustedOrigins implicitly allow requests from the corresponding HTTP origins, allowing network MitMs to perform CSRF attacks.\n\nAfter 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.\n\nHowever, 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.\n\nApplications 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.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:A/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:U"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gorilla/csrf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.7.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-47909"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/golang/vulndb/issues/3884"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gorilla/csrf"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2025-3884"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-352", "CWE-807" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-29T20:23:16Z",
    "nvd_published_at" : "2025-08-29T16:15:35Z"
  }
}